From fhtapia at gmail.com Tue Jan 2 18:47:29 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 2 Jan 2007 16:47:29 -0800 Subject: [dba-SQLServer] Restoring Database from Another server In-Reply-To: <20061214183054.DZGY26962.fep01.xtra.co.nz@Dalyn.dalyn.co.nz> References: <20061214172129.HBZD27893.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> <20061214183054.DZGY26962.fep01.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: David, I'm sorry that I've taken too long to reply, hopefully, it was not too much of a problem. When you already have users on a destination server it is no longer necessary to re-apply them, they are already there. I've seen "slow" Databases but that is generally an architecture problem. That is, Your HDD may be too slow, on the server w/ the slowest response. If you're running all of this on the same server but the last version of the DB is slow then I would take a look at the physical fragmentations, stop the service if you are able to (non-production servers) and run the Defrag utility in windows, this usually will do the trick. Other problems for very slow db response times can be because you have the page file on the same disk as the database, or you do not have enough ram, and the results you are expecting are too large. On 12/14/06, David Emerson wrote: > The users we want are the existing ones on the destination server, > not the source server. They already exist for another database on > the destination server. Will I need to save the current users on the > destination server and reapply them once the database is restored? > > David > > At 15/12/2006, you wrote: > >There are, if you re-created users on each server then the mappings > >for rights won't go over well, You can always run the ophaned user > >script to re-enable this easily or, alternatively migrate user > >information from the source server to the destination, if this was > >done initially then there won't be any problems. I'm curious tho, you > >say your db may be corrupt, I've seen very few "suspect" dbs on Sql > >Server 2000 what are the symptoms you are experianceing? > > > >ref: > >http://sqlthis.blogspot.com/2006/01/migrating-logins-from-one-sql-server.html > > > > > >On 12/14/06, David Emerson wrote: > > > I sent this to the general list but it seems more appropriate for this one. > > > > > > I am looking at the probability of needing to restore a database from > > > my development computer to a client site (overwriting the old > > > possibly corrupt version). > > > > > > There are users and permisions set up on both computers (they should > > > be identical) > > > > > > Are there any things I should be aware of that may cause problems (eg > > > user and role settings not being compatible across the two computers?) > > > > > > > > > Regards > > > > > > David Emerson > > > Dalyn Software Ltd > > > Wellington, New Zealand > > > > > > > > > > >-- > >-Francisco > >http://sqlthis.blogspot.com | Tsql and More... > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From newsgrps at dalyn.co.nz Tue Jan 2 18:58:59 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Wed, 03 Jan 2007 13:58:59 +1300 Subject: [dba-SQLServer] Restoring Database from Another server In-Reply-To: References: <20061214172129.HBZD27893.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> <20061214183054.DZGY26962.fep01.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: <20070103005719.KKYT19965.fep01.xtra.co.nz@Dalyn.dalyn.co.nz> Francisco, Thanks for the reply. The problem seems to have solved itself over the holidays. The IT team did some work on the server so they may have defraged the database. However, I will file away your suggestions for the future. Regards David At 3/01/2007, you wrote: >David, > I'm sorry that I've taken too long to reply, hopefully, it was not >too much of a problem. When you already have users on a destination >server it is no longer necessary to re-apply them, they are already >there. I've seen "slow" Databases but that is generally an >architecture problem. That is, Your HDD may be too slow, on the >server w/ the slowest response. > >If you're running all of this on the same server but the last version >of the DB is slow then I would take a look at the physical >fragmentations, stop the service if you are able to (non-production >servers) and run the Defrag utility in windows, this usually will do >the trick. Other problems for very slow db response times can be >because you have the page file on the same disk as the database, or >you do not have enough ram, and the results you are expecting are too >large. > > > >On 12/14/06, David Emerson wrote: > > The users we want are the existing ones on the destination server, > > not the source server. They already exist for another database on > > the destination server. Will I need to save the current users on the > > destination server and reapply them once the database is restored? > > > > David > > > > At 15/12/2006, you wrote: > > >There are, if you re-created users on each server then the mappings > > >for rights won't go over well, You can always run the ophaned user > > >script to re-enable this easily or, alternatively migrate user > > >information from the source server to the destination, if this was > > >done initially then there won't be any problems. I'm curious tho, you > > >say your db may be corrupt, I've seen very few "suspect" dbs on Sql > > >Server 2000 what are the symptoms you are experianceing? > > > > > >ref: > > >http://sqlthis.blogspot.com/2006/01/migrating-logins-from-one-sql > -server.html > > > > > > > > >On 12/14/06, David Emerson wrote: > > > > I sent this to the general list but it seems more appropriate > for this one. > > > > > > > > I am looking at the probability of needing to restore a database from > > > > my development computer to a client site (overwriting the old > > > > possibly corrupt version). > > > > > > > > There are users and permisions set up on both computers (they should > > > > be identical) > > > > > > > > Are there any things I should be aware of that may cause problems (eg > > > > user and role settings not being compatible across the two computers?) > > > > > > > > > > > > Regards > > > > > > > > David Emerson > > > > Dalyn Software Ltd > > > > Wellington, New Zealand > > > > > > > > > > > > > > > >-- > > >-Francisco > > >http://sqlthis.blogspot.com | Tsql and More... > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > >-- >-Francisco >http://sqlthis.blogspot.com | Tsql and More... >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com From artful at rogers.com Wed Jan 3 11:46:54 2007 From: artful at rogers.com (artful at rogers.com) Date: Wed, 3 Jan 2007 09:46:54 -0800 (PST) Subject: [dba-SQLServer] A2007 + SQL 2005 Message-ID: <20070103174654.76645.qmail@web88207.mail.re2.yahoo.com> My experience thus far with A2007 is quite limited. I have a few questions: 1. One of the really advances in SQL 2005 is its revised notion of schemas. This can be seen in the AdventureWorks sample db. Schemas allow you to divide the tables in a database into logical groups. The table is thus named: MySchema.MyTable Does A2007 support this? 2. What about the various forms of UDFs (scalar, table-valued, etc.)? Are they all supported? TIA, Arthur From artful at rogers.com Thu Jan 4 16:19:44 2007 From: artful at rogers.com (artful at rogers.com) Date: Thu, 4 Jan 2007 14:19:44 -0800 (PST) Subject: [dba-SQLServer] Database market share Message-ID: <20070104221944.19768.qmail@web88203.mail.re2.yahoo.com> The few sites I have found that cite any stats on this use total revenues rather than number of seats. I am more interested in discovering the market share in terms of number of working DBAs and programmers. Oracle claims a 39% share of total DB revenues but that is skewed by the measure of revenues, rather than the number of developer seats. I want to know how many people make their living either as DBAs or programmers in the top 5 databases (Oracle, DB2, MS-SQL, MySQL and ). I cannot find stats on this. Can you provide a link that provides these numbers? TIA, Arthur From jwcolby at colbyconsulting.com Thu Jan 11 07:21:59 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Thu, 11 Jan 2007 08:21:59 -0500 Subject: [dba-SQLServer] Interfacing MDB to SQL Server to user groups Message-ID: <00a301c73583$79d7eb50$657aa8c0@m6805> One of my databases interfaces to a third party SQL Server. I need to link to a view in the database, and then display that view in a subform. This all works for me and my client "boss", since we both have administrator rights, but regular users of the database get "no permissions" kinds of error messages when they try to view the data. Is it possible to have a Windows (domain) user group control access to such a view? My concern is that the client already has to deal with adding users to the domain groups, and I don't want to add another SQL Server layer to that maintenance. If SQL Server can say "anyone belonging to Windows user group XXX can access the view, that problem would be avoided. If it can be done, can you provide a brief description of how. This is an existing database, controlled by a third party (payroll service), and I am not looking for the nitty gritty, just a generalized one paragraph explanation if that is possible. John W. Colby Colby Consulting www.ColbyConsulting.com From mwp.reid at qub.ac.uk Thu Jan 11 07:36:44 2007 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Thu, 11 Jan 2007 13:36:44 -0000 Subject: [dba-SQLServer] Interfacing MDB to SQL Server to user groups References: <00a301c73583$79d7eb50$657aa8c0@m6805> Message-ID: John http://www.windowsitlibrary.com/Content/77/10/2.html should cover it Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: dba-sqlserver-bounces at databaseadvisors.com on behalf of JWColby Sent: Thu 11/01/2007 13:21 To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Interfacing MDB to SQL Server to user groups One of my databases interfaces to a third party SQL Server. I need to link to a view in the database, and then display that view in a subform. This all works for me and my client "boss", since we both have administrator rights, but regular users of the database get "no permissions" kinds of error messages when they try to view the data. Is it possible to have a Windows (domain) user group control access to such a view? My concern is that the client already has to deal with adding users to the domain groups, and I don't want to add another SQL Server layer to that maintenance. If SQL Server can say "anyone belonging to Windows user group XXX can access the view, that problem would be avoided. If it can be done, can you provide a brief description of how. This is an existing database, controlled by a third party (payroll service), and I am not looking for the nitty gritty, just a generalized one paragraph explanation if that is possible. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Thu Jan 11 07:49:29 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Thu, 11 Jan 2007 08:49:29 -0500 Subject: [dba-SQLServer] Interfacing MDB to SQL Server to user groups In-Reply-To: Message-ID: <00b401c73587$516e7900$657aa8c0@m6805> Thanks. I have forwarded that to the client. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Martin Reid Sent: Thursday, January 11, 2007 8:37 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Interfacing MDB to SQL Server to user groups John http://www.windowsitlibrary.com/Content/77/10/2.html should cover it Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: dba-sqlserver-bounces at databaseadvisors.com on behalf of JWColby Sent: Thu 11/01/2007 13:21 To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Interfacing MDB to SQL Server to user groups One of my databases interfaces to a third party SQL Server. I need to link to a view in the database, and then display that view in a subform. This all works for me and my client "boss", since we both have administrator rights, but regular users of the database get "no permissions" kinds of error messages when they try to view the data. Is it possible to have a Windows (domain) user group control access to such a view? My concern is that the client already has to deal with adding users to the domain groups, and I don't want to add another SQL Server layer to that maintenance. If SQL Server can say "anyone belonging to Windows user group XXX can access the view, that problem would be avoided. If it can be done, can you provide a brief description of how. This is an existing database, controlled by a third party (payroll service), and I am not looking for the nitty gritty, just a generalized one paragraph explanation if that is possible. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Thu Jan 11 21:14:22 2007 From: artful at rogers.com (artful at rogers.com) Date: Thu, 11 Jan 2007 19:14:22 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Message-ID: <20070112031422.91542.qmail@web88205.mail.re2.yahoo.com> I write this from Canada, wherein the days designated Holidays vary from province to province. Some Holidays are designated National and apply to all provinces. Other Holidays are local to the particular province of interest. Does the same thing apply to the USA? Are there, for example, holidays in Georgia that are not recognized in New York? Is there some definitive list of these that can be downloaded from someplace? Second, one assumes that this also applies to other nations. Let us take Switzerland as a hypothetical example. Are there holidays in Canton X that are not holidays in Canton Y? Gustav, what say you about Denmark? (I confess that I don't even know what a region of Denmark is called -- a province? a state? an enclave?) I think we have a few Dutch listers here too. What say you? Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? etc. One assumes, based solely on the difference between Canada and the USA, that there are different national holidays and also "provincial" holidays. Can anyone supply more detail into this? TIA, Arthur TIA, Arthur From artful at rogers.com Thu Jan 11 21:34:17 2007 From: artful at rogers.com (artful at rogers.com) Date: Thu, 11 Jan 2007 19:34:17 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Message-ID: <20070112033417.81532.qmail@web88207.mail.re2.yahoo.com> One assumes that BusinessDaysBetween (@d1, @d2) observes the Holidays table and also ignores Saturday and Sunday (which admittedly could be wrong, but let's at first keep it simple). So: Inputs are 01-01-2007 and 02-28-2007. Assume that Saturday and Sunday are not business days. (This subject to revision, but later.) Assume that there are two holidays in January, the 16th and the 25th (chosen arbitrarily, I grant you, although I made sure they weren't Saturday or Sunday, else the exercise would be pointless). Algorithm: Build a temp table consisting of the dates between x and y. Subtract the dates existing in our holidays table. Subtract the dates describing our weekends. Sum the remaining days. Return the count. Holes in the algorithm? Please point them out before I cast this in stone. TIA, Arthur From stuart at lexacorp.com.pg Thu Jan 11 22:21:46 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Fri, 12 Jan 2007 14:21:46 +1000 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. In-Reply-To: <20070112031422.91542.qmail@web88205.mail.re2.yahoo.com> References: <20070112031422.91542.qmail@web88205.mail.re2.yahoo.com> Message-ID: <45A70CDA.28004.3B2C55FF@stuart.lexacorp.com.pg> On 11 Jan 2007 at 19:14, artful at rogers.com wrote: > > One assumes, based solely on the difference between Canada and the USA, that > there are different national holidays and also "provincial" holidays. > > Can anyone supply more detail into this? Australia certainly has public holidays by State - see http://www.australia.gov.au/302 Follow the link to Victoria - It's got to be the only place in the world where almost the entire state has a public holiday because of a horse race (Melbourne Cup). -- Stuart From DElam at jenkens.com Fri Jan 12 08:24:57 2007 From: DElam at jenkens.com (Elam, Debbie) Date: Fri, 12 Jan 2007 08:24:57 -0600 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/ etc. Message-ID: <7B1961ED924D1A459E378C9B1BB22B4C068DEB47@natexch.jenkens.com> There are state holidays in the US as well as national ones. For the most part, only State employees take the state holidays off. There are sometimes local holidays as well. Where I work, we have another office in the same state that takes a holiday for a local festival. To be fair, they probably could not get into the building that day anyhow. They have a street festival happening practically in their laps. Debbie -----Original Message----- From: artful at rogers.com [mailto:artful at rogers.com] Sent: Thursday, January 11, 2007 9:14 PM To: dba-SQLServer Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. I write this from Canada, wherein the days designated Holidays vary from province to province. Some Holidays are designated National and apply to all provinces. Other Holidays are local to the particular province of interest. Does the same thing apply to the USA? Are there, for example, holidays in Georgia that are not recognized in New York? Is there some definitive list of these that can be downloaded from someplace? Second, one assumes that this also applies to other nations. Let us take Switzerland as a hypothetical example. Are there holidays in Canton X that are not holidays in Canton Y? Gustav, what say you about Denmark? (I confess that I don't even know what a region of Denmark is called -- a province? a state? an enclave?) I think we have a few Dutch listers here too. What say you? Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? etc. One assumes, based solely on the difference between Canada and the USA, that there are different national holidays and also "provincial" holidays. Can anyone supply more detail into this? TIA, Arthur TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com - JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) subject to the Attorney-Client Privilege, (2) an attorney work product, or (3) strictly confidential. If you are not the intended recipient of this message, you may not disclose, print, copy or disseminate this information. If you have received this in error, please reply and notify the sender (only) and delete the message. Unauthorized interception of this e-mail is a violation of federal criminal law. This communication does not reflect an intention by the sender or the sender's client or principal to conduct a transaction or make any agreement by electronic means. Nothing contained in this message or in any attachment shall satisfy the requirements for a writing, and nothing contained herein shall constitute a contract or electronic signature under the Electronic Signatures in Global and National Commerce Act, any version of the Uniform Electronic Transactions Act or any other statute governing electronic transactions. From dwaters at usinternet.com Fri Jan 12 09:17:16 2007 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 12 Jan 2007 09:17:16 -0600 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. In-Reply-To: <3299986.1168572983913.JavaMail.root@sniper46> References: <3299986.1168572983913.JavaMail.root@sniper46> Message-ID: <007601c7365c$bfb379d0$0200a8c0@danwaters> Hi Arthur! This is my method: Have a permanent table that contains Holidays. Because each company has their own Holiday schedule, they will need to be able to populate this. 1) Calculate days between dates. 2) Subtract weekend days. 3) Subtract any Holidays that fall between the two dates. That's it! Dan Waters -----Original Message----- Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. One assumes that BusinessDaysBetween (@d1, @d2) observes the Holidays table and also ignores Saturday and Sunday (which admittedly could be wrong, but let's at first keep it simple). So: Inputs are 01-01-2007 and 02-28-2007. Assume that Saturday and Sunday are not business days. (This subject to revision, but later.) Assume that there are two holidays in January, the 16th and the 25th (chosen arbitrarily, I grant you, although I made sure they weren't Saturday or Sunday, else the exercise would be pointless). Algorithm: Build a temp table consisting of the dates between x and y. Subtract the dates existing in our holidays table. Subtract the dates describing our weekends. Sum the remaining days. Return the count. Holes in the algorithm? Please point them out before I cast this in stone. TIA, Arthur From markamatte at hotmail.com Fri Jan 12 09:19:32 2007 From: markamatte at hotmail.com (Mark A Matte) Date: Fri, 12 Jan 2007 15:19:32 +0000 Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. In-Reply-To: <7B1961ED924D1A459E378C9B1BB22B4C068DEB47@natexch.jenkens.com> Message-ID: I'm originally from Lafayette Louisiana...and growing up...we had almost a week out of school for Mardi Gras...and most definetely the local businesses closed...unless they served food or drink. I've lived in many different US states...there are different Holidays for different cities, much less the states. Now that I'm typing it...I remember in Louisiana, the following cities would have the following 'holiday'/festival that would pretty much encompass the whole community: Breaux Bridge...the Crawfish Festival Crowley...the Rice Festival Raine(where I was born)...The Frog Festival And these are just a few that I remember. I think there is no set guidelines...I mean a company could even create its own 'private' holiday where they just pick a day and close up shop. Seems like there is no logic to be applied. Not sure if it answers anything, but a walk down memory lane for me. Thanks, Mark A. Matte >From: "Elam, Debbie" >Reply-To: dba-sqlserver at databaseadvisors.com >To: "'dba-sqlserver at databaseadvisors.com'" > >Subject: Re: [dba-SQLServer] Holidays by Nation >andState/Province/Canton/ etc. >Date: Fri, 12 Jan 2007 08:24:57 -0600 > >There are state holidays in the US as well as national ones. For the most >part, only State employees take the state holidays off. There are >sometimes >local holidays as well. Where I work, we have another office in the same >state that takes a holiday for a local festival. To be fair, they probably >could not get into the building that day anyhow. They have a street >festival happening practically in their laps. > >Debbie > >-----Original Message----- >From: artful at rogers.com [mailto:artful at rogers.com] >Sent: Thursday, January 11, 2007 9:14 PM >To: dba-SQLServer >Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. > > >I write this from Canada, wherein the days designated Holidays vary from >province to province. Some Holidays are designated National and apply to >all >provinces. Other Holidays are local to the particular province of interest. > >Does the same thing apply to the USA? Are there, for example, holidays in >Georgia that are not recognized in New York? Is there some definitive list >of these that can be downloaded from someplace? > >Second, one assumes that this also applies to other nations. Let us take >Switzerland as a hypothetical example. Are there holidays in Canton X that >are not holidays in Canton Y? > >Gustav, what say you about Denmark? (I confess that I don't even know what >a >region of Denmark is called -- a province? a state? an enclave?) > >I think we have a few Dutch listers here too. What say you? > >Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? >etc. > >One assumes, based solely on the difference between Canada and the USA, >that >there are different national holidays and also "provincial" holidays. > >Can anyone supply more detail into this? > >TIA, >Arthur > > >TIA, >Arthur > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com >- JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) subject >to the Attorney-Client Privilege, (2) an attorney work product, or (3) >strictly confidential. If you are not the intended recipient of this >message, you may not disclose, print, copy or disseminate this information. >If you have received this in error, please reply and notify the sender >(only) and delete the message. Unauthorized interception of this e-mail is >a >violation of federal criminal law. >This communication does not reflect an intention by the sender or the >sender's client or principal to conduct a transaction or make any agreement >by electronic means. Nothing contained in this message or in any >attachment >shall satisfy the requirements for a writing, and nothing contained herein >shall constitute a contract or electronic signature under the Electronic >Signatures in Global and National Commerce Act, any version of the Uniform >Electronic Transactions Act or any other statute governing electronic >transactions. >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2 From jwcolby at colbyconsulting.com Fri Jan 12 09:28:53 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Fri, 12 Jan 2007 10:28:53 -0500 Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/etc. In-Reply-To: Message-ID: <002301c7365e$5e950a40$657aa8c0@m6805> >...The Frog Festival You know you're in hicksville when... ;-) John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark A Matte Sent: Friday, January 12, 2007 10:20 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Holidays by Nation andState/Province/Canton/etc. I'm originally from Lafayette Louisiana...and growing up...we had almost a week out of school for Mardi Gras...and most definetely the local businesses closed...unless they served food or drink. I've lived in many different US states...there are different Holidays for different cities, much less the states. Now that I'm typing it...I remember in Louisiana, the following cities would have the following 'holiday'/festival that would pretty much encompass the whole community: Breaux Bridge...the Crawfish Festival Crowley...the Rice Festival Raine(where I was born)...The Frog Festival And these are just a few that I remember. I think there is no set guidelines...I mean a company could even create its own 'private' holiday where they just pick a day and close up shop. Seems like there is no logic to be applied. Not sure if it answers anything, but a walk down memory lane for me. Thanks, Mark A. Matte >From: "Elam, Debbie" >Reply-To: dba-sqlserver at databaseadvisors.com >To: "'dba-sqlserver at databaseadvisors.com'" > >Subject: Re: [dba-SQLServer] Holidays by Nation >andState/Province/Canton/ etc. >Date: Fri, 12 Jan 2007 08:24:57 -0600 > >There are state holidays in the US as well as national ones. For the >most part, only State employees take the state holidays off. There are >sometimes local holidays as well. Where I work, we have another office >in the same state that takes a holiday for a local festival. To be >fair, they probably could not get into the building that day anyhow. >They have a street festival happening practically in their laps. > >Debbie > >-----Original Message----- >From: artful at rogers.com [mailto:artful at rogers.com] >Sent: Thursday, January 11, 2007 9:14 PM >To: dba-SQLServer >Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. > > >I write this from Canada, wherein the days designated Holidays vary >from province to province. Some Holidays are designated National and >apply to all provinces. Other Holidays are local to the particular >province of interest. > >Does the same thing apply to the USA? Are there, for example, holidays >in Georgia that are not recognized in New York? Is there some >definitive list of these that can be downloaded from someplace? > >Second, one assumes that this also applies to other nations. Let us >take Switzerland as a hypothetical example. Are there holidays in >Canton X that are not holidays in Canton Y? > >Gustav, what say you about Denmark? (I confess that I don't even know >what a region of Denmark is called -- a province? a state? an enclave?) > >I think we have a few Dutch listers here too. What say you? > >Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? >etc. > >One assumes, based solely on the difference between Canada and the USA, >that there are different national holidays and also "provincial" >holidays. > >Can anyone supply more detail into this? > >TIA, >Arthur > > >TIA, >Arthur > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com >- JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) >subject to the Attorney-Client Privilege, (2) an attorney work product, >or (3) strictly confidential. If you are not the intended recipient of >this message, you may not disclose, print, copy or disseminate this information. >If you have received this in error, please reply and notify the sender >(only) and delete the message. Unauthorized interception of this e-mail >is a violation of federal criminal law. >This communication does not reflect an intention by the sender or the >sender's client or principal to conduct a transaction or make any >agreement by electronic means. Nothing contained in this message or in >any attachment shall satisfy the requirements for a writing, and >nothing contained herein shall constitute a contract or electronic >signature under the Electronic Signatures in Global and National >Commerce Act, any version of the Uniform Electronic Transactions Act or >any other statute governing electronic transactions. >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Fri Jan 12 09:49:20 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 07:49:20 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/ etc. Message-ID: <20070112154920.61570.qmail@web88207.mail.re2.yahoo.com> Thanks for your reply. It appears from your reply and others that there is no modeling choice but to have a table recording the holidays of interest in the jurisdictions of interest. Then, using this table to metaphorically subtract those days from the date range of interest, we can then determine the number of business days between x and y. Arthur ----- Original Message ---- From: "Elam, Debbie" To: "dba-sqlserver at databaseadvisors.com" Sent: Friday, January 12, 2007 9:24:57 AM Subject: Re: [dba-SQLServer] Holidays by Nation and State/Province/Canton/ etc. There are state holidays in the US as well as national ones. For the most part, only State employees take the state holidays off. There are sometimes local holidays as well. Where I work, we have another office in the same state that takes a holiday for a local festival. To be fair, they probably could not get into the building that day anyhow. They have a street festival happening practically in their laps. Debbie -----Original Message----- From: artful at rogers.com [mailto:artful at rogers.com] Sent: Thursday, January 11, 2007 9:14 PM To: dba-SQLServer Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. I write this from Canada, wherein the days designated Holidays vary from province to province. Some Holidays are designated National and apply to all provinces. Other Holidays are local to the particular province of interest. Does the same thing apply to the USA? Are there, for example, holidays in Georgia that are not recognized in New York? Is there some definitive list of these that can be downloaded from someplace? Second, one assumes that this also applies to other nations. Let us take Switzerland as a hypothetical example. Are there holidays in Canton X that are not holidays in Canton Y? Gustav, what say you about Denmark? (I confess that I don't even know what a region of Denmark is called -- a province? a state? an enclave?) I think we have a few Dutch listers here too. What say you? Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? etc. One assumes, based solely on the difference between Canada and the USA, that there are different national holidays and also "provincial" holidays. Can anyone supply more detail into this? TIA, Arthur TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com - JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) subject to the Attorney-Client Privilege, (2) an attorney work product, or (3) strictly confidential. If you are not the intended recipient of this message, you may not disclose, print, copy or disseminate this information. If you have received this in error, please reply and notify the sender (only) and delete the message. Unauthorized interception of this e-mail is a violation of federal criminal law. This communication does not reflect an intention by the sender or the sender's client or principal to conduct a transaction or make any agreement by electronic means. Nothing contained in this message or in any attachment shall satisfy the requirements for a writing, and nothing contained herein shall constitute a contract or electronic signature under the Electronic Signatures in Global and National Commerce Act, any version of the Uniform Electronic Transactions Act or any other statute governing electronic transactions. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Fri Jan 12 09:52:31 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 07:52:31 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Message-ID: <20070112155231.20771.qmail@web88204.mail.re2.yahoo.com> Yes. Only thing you overlooked is that a given company might operate in several jurisdictions (counties, states, countries) where the Holiday Rules change, so we also need a table defining the jurisdictions in which the holidays apply. However, your insight is right on the money. I shall work on this and see if there is some way to gather this info from the net or from various listers. Thanks. A. ----- Original Message ---- From: Dan Waters To: dba-sqlserver at databaseadvisors.com Sent: Friday, January 12, 2007 10:17:16 AM Subject: Re: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Hi Arthur! This is my method: Have a permanent table that contains Holidays. Because each company has their own Holiday schedule, they will need to be able to populate this. 1) Calculate days between dates. 2) Subtract weekend days. 3) Subtract any Holidays that fall between the two dates. That's it! Dan Waters -----Original Message----- Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. One assumes that BusinessDaysBetween (@d1, @d2) observes the Holidays table and also ignores Saturday and Sunday (which admittedly could be wrong, but let's at first keep it simple). So: Inputs are 01-01-2007 and 02-28-2007. Assume that Saturday and Sunday are not business days. (This subject to revision, but later.) Assume that there are two holidays in January, the 16th and the 25th (chosen arbitrarily, I grant you, although I made sure they weren't Saturday or Sunday, else the exercise would be pointless). Algorithm: Build a temp table consisting of the dates between x and y. Subtract the dates existing in our holidays table. Subtract the dates describing our weekends. Sum the remaining days. Return the count. Holes in the algorithm? Please point them out before I cast this in stone. TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Fri Jan 12 09:59:29 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 07:59:29 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. Message-ID: <20070112155930.26455.qmail@web88213.mail.re2.yahoo.com> A walk down memory lane! When I was a child, and also a meat-eater, Canada Day was celebrated by eating buffalo burgers in the parking lot of a big-box grocer called Loblaws. Now I eat no meat, but I do recall buffalo burgers. Anyway, it seems clear that the only way to deal with the problem of BusinessDays is to have a table recording all the holidays local to a region, and then to link said region to a Regions table (since a given company might well have branches in many regions). Arthur ----- Original Message ---- From: Mark A Matte To: dba-sqlserver at databaseadvisors.com Sent: Friday, January 12, 2007 10:19:32 AM Subject: Re: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. I'm originally from Lafayette Louisiana...and growing up...we had almost a week out of school for Mardi Gras...and most definetely the local businesses closed...unless they served food or drink. I've lived in many different US states...there are different Holidays for different cities, much less the states. Now that I'm typing it...I remember in Louisiana, the following cities would have the following 'holiday'/festival that would pretty much encompass the whole community: Breaux Bridge...the Crawfish Festival Crowley...the Rice Festival Raine(where I was born)...The Frog Festival And these are just a few that I remember. I think there is no set guidelines...I mean a company could even create its own 'private' holiday where they just pick a day and close up shop. Seems like there is no logic to be applied. Not sure if it answers anything, but a walk down memory lane for me. Thanks, Mark A. Matte >From: "Elam, Debbie" >Reply-To: dba-sqlserver at databaseadvisors.com >To: "'dba-sqlserver at databaseadvisors.com'" > >Subject: Re: [dba-SQLServer] Holidays by Nation >andState/Province/Canton/ etc. >Date: Fri, 12 Jan 2007 08:24:57 -0600 > >There are state holidays in the US as well as national ones. For the most >part, only State employees take the state holidays off. There are >sometimes >local holidays as well. Where I work, we have another office in the same >state that takes a holiday for a local festival. To be fair, they probably >could not get into the building that day anyhow. They have a street >festival happening practically in their laps. > >Debbie > >-----Original Message----- >From: artful at rogers.com [mailto:artful at rogers.com] >Sent: Thursday, January 11, 2007 9:14 PM >To: dba-SQLServer >Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. > > >I write this from Canada, wherein the days designated Holidays vary from >province to province. Some Holidays are designated National and apply to >all >provinces. Other Holidays are local to the particular province of interest. > >Does the same thing apply to the USA? Are there, for example, holidays in >Georgia that are not recognized in New York? Is there some definitive list >of these that can be downloaded from someplace? > >Second, one assumes that this also applies to other nations. Let us take >Switzerland as a hypothetical example. Are there holidays in Canton X that >are not holidays in Canton Y? > >Gustav, what say you about Denmark? (I confess that I don't even know what >a >region of Denmark is called -- a province? a state? an enclave?) > >I think we have a few Dutch listers here too. What say you? > >Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? >etc. > >One assumes, based solely on the difference between Canada and the USA, >that >there are different national holidays and also "provincial" holidays. > >Can anyone supply more detail into this? > >TIA, >Arthur > > >TIA, >Arthur > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com >- JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) subject >to the Attorney-Client Privilege, (2) an attorney work product, or (3) >strictly confidential. If you are not the intended recipient of this >message, you may not disclose, print, copy or disseminate this information. >If you have received this in error, please reply and notify the sender >(only) and delete the message. Unauthorized interception of this e-mail is >a >violation of federal criminal law. >This communication does not reflect an intention by the sender or the >sender's client or principal to conduct a transaction or make any agreement >by electronic means. Nothing contained in this message or in any >attachment >shall satisfy the requirements for a writing, and nothing contained herein >shall constitute a contract or electronic signature under the Electronic >Signatures in Global and National Commerce Act, any version of the Uniform >Electronic Transactions Act or any other statute governing electronic >transactions. >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Fri Jan 12 10:03:55 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 08:03:55 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. Message-ID: <20070112160355.34221.qmail@web88209.mail.re2.yahoo.com> As it happens, I know several friends who own and operate bars/taverns/restaurants. These folks do not operate on the assumption that Saturday and Sunday are days off: precisely the opposite in fact. So the concept of "weekends" has to go. My good friend Jerry for example works Saturday and Sunday and considers his weekend Monday and Tuesday, I am unsure how to model this. ----- Original Message ---- From: Mark A Matte To: dba-sqlserver at databaseadvisors.com Sent: Friday, January 12, 2007 10:19:32 AM Subject: Re: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. I'm originally from Lafayette Louisiana...and growing up...we had almost a week out of school for Mardi Gras...and most definetely the local businesses closed...unless they served food or drink. I've lived in many different US states...there are different Holidays for different cities, much less the states. Now that I'm typing it...I remember in Louisiana, the following cities would have the following 'holiday'/festival that would pretty much encompass the whole community: Breaux Bridge...the Crawfish Festival Crowley...the Rice Festival Raine(where I was born)...The Frog Festival And these are just a few that I remember. I think there is no set guidelines...I mean a company could even create its own 'private' holiday where they just pick a day and close up shop. Seems like there is no logic to be applied. Not sure if it answers anything, but a walk down memory lane for me. Thanks, Mark A. Matte >From: "Elam, Debbie" >Reply-To: dba-sqlserver at databaseadvisors.com >To: "'dba-sqlserver at databaseadvisors.com'" > >Subject: Re: [dba-SQLServer] Holidays by Nation >andState/Province/Canton/ etc. >Date: Fri, 12 Jan 2007 08:24:57 -0600 > >There are state holidays in the US as well as national ones. For the most >part, only State employees take the state holidays off. There are >sometimes >local holidays as well. Where I work, we have another office in the same >state that takes a holiday for a local festival. To be fair, they probably >could not get into the building that day anyhow. They have a street >festival happening practically in their laps. > >Debbie > >-----Original Message----- >From: artful at rogers.com [mailto:artful at rogers.com] >Sent: Thursday, January 11, 2007 9:14 PM >To: dba-SQLServer >Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. > > >I write this from Canada, wherein the days designated Holidays vary from >province to province. Some Holidays are designated National and apply to >all >provinces. Other Holidays are local to the particular province of interest. > >Does the same thing apply to the USA? Are there, for example, holidays in >Georgia that are not recognized in New York? Is there some definitive list >of these that can be downloaded from someplace? > >Second, one assumes that this also applies to other nations. Let us take >Switzerland as a hypothetical example. Are there holidays in Canton X that >are not holidays in Canton Y? > >Gustav, what say you about Denmark? (I confess that I don't even know what >a >region of Denmark is called -- a province? a state? an enclave?) > >I think we have a few Dutch listers here too. What say you? > >Any French? Belgians? Italians? Spanish? Portuguese? Bulgarians? Serbians? >etc. > >One assumes, based solely on the difference between Canada and the USA, >that >there are different national holidays and also "provincial" holidays. > >Can anyone supply more detail into this? > >TIA, >Arthur > > >TIA, >Arthur > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com >- JENKENS & GILCHRIST E-MAIL NOTICE - This transmission may be: (1) subject >to the Attorney-Client Privilege, (2) an attorney work product, or (3) >strictly confidential. If you are not the intended recipient of this >message, you may not disclose, print, copy or disseminate this information. >If you have received this in error, please reply and notify the sender >(only) and delete the message. Unauthorized interception of this e-mail is >a >violation of federal criminal law. >This communication does not reflect an intention by the sender or the >sender's client or principal to conduct a transaction or make any agreement >by electronic means. Nothing contained in this message or in any >attachment >shall satisfy the requirements for a writing, and nothing contained herein >shall constitute a contract or electronic signature under the Electronic >Signatures in Global and National Commerce Act, any version of the Uniform >Electronic Transactions Act or any other statute governing electronic >transactions. >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ The MSN Entertainment Guide to Golden Globes is here. Get all the scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From carbonnb at gmail.com Fri Jan 12 11:03:35 2007 From: carbonnb at gmail.com (Bryan Carbonnell) Date: Fri, 12 Jan 2007 12:03:35 -0500 Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. In-Reply-To: <20070112160355.34221.qmail@web88209.mail.re2.yahoo.com> References: <20070112160355.34221.qmail@web88209.mail.re2.yahoo.com> Message-ID: On 1/12/07, artful at rogers.com wrote: > As it happens, I know several friends who own and operate bars/taverns/restaurants. These folks do not operate on the assumption that Saturday and Sunday are days off: precisely the opposite in fact. So the concept of "weekends" has to go. My good friend Jerry for example works Saturday and Sunday and considers his weekend Monday and Tuesday, > > I am unsure how to model this. Well, at work we have folks that work shift work all over the place, so the concept of weekends are only for those of us that work in the office. instead we use the concept of Days Off, not weekends. Your days off, 2 per week which is Monday to Sunday, can be anything, but they have to be consecutive. So for those folks, there are 5 business days and 2 Days off per week. So that may be one way to model it, a week has 5 business days and 2 days off. It doesn't really matter which specific days they are. -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" From mwp.reid at qub.ac.uk Fri Jan 12 11:12:14 2007 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Fri, 12 Jan 2007 17:12:14 -0000 Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/etc. References: <20070112160355.34221.qmail@web88209.mail.re2.yahoo.com> Message-ID: You can also have a working week which can be any combination of days at all. Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: dba-sqlserver-bounces at databaseadvisors.com on behalf of Bryan Carbonnell Sent: Fri 12/01/2007 17:03 To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Holidays by Nation andState/Province/Canton/etc. On 1/12/07, artful at rogers.com wrote: > As it happens, I know several friends who own and operate bars/taverns/restaurants. These folks do not operate on the assumption that Saturday and Sunday are days off: precisely the opposite in fact. So the concept of "weekends" has to go. My good friend Jerry for example works Saturday and Sunday and considers his weekend Monday and Tuesday, > > I am unsure how to model this. Well, at work we have folks that work shift work all over the place, so the concept of weekends are only for those of us that work in the office. instead we use the concept of Days Off, not weekends. Your days off, 2 per week which is Monday to Sunday, can be anything, but they have to be consecutive. So for those folks, there are 5 business days and 2 Days off per week. So that may be one way to model it, a week has 5 business days and 2 days off. It doesn't really matter which specific days they are. -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jlawrenc1 at shaw.ca Fri Jan 12 15:15:18 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Fri, 12 Jan 2007 13:15:18 -0800 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. In-Reply-To: <20070112033417.81532.qmail@web88207.mail.re2.yahoo.com> Message-ID: <0JBR0081DXM58DU1@l-daemon> Hi Arthur: The holidays for a specific region can be easily calculated and automated from years to year. The only really difficult calculation seems to be Easter. The problem that I found was that every region has it own way of interpreting holidays. North America alone would take a fair bit of research and internationally it could be a career move. The way I have traditionally handled holidays is to have a trigger, that rerun a section of code that repopulates the holiday table, at the beginning of the year and then various apps can refer to the definitive list. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Thursday, January 11, 2007 7:34 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. One assumes that BusinessDaysBetween (@d1, @d2) observes the Holidays table and also ignores Saturday and Sunday (which admittedly could be wrong, but let's at first keep it simple). So: Inputs are 01-01-2007 and 02-28-2007. Assume that Saturday and Sunday are not business days. (This subject to revision, but later.) Assume that there are two holidays in January, the 16th and the 25th (chosen arbitrarily, I grant you, although I made sure they weren't Saturday or Sunday, else the exercise would be pointless). Algorithm: Build a temp table consisting of the dates between x and y. Subtract the dates existing in our holidays table. Subtract the dates describing our weekends. Sum the remaining days. Return the count. Holes in the algorithm? Please point them out before I cast this in stone. TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Fri Jan 12 15:58:24 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 13:58:24 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. Message-ID: <20070112215824.10099.qmail@web88207.mail.re2.yahoo.com> So, the CBC works on the same schedule as most bars and taverns. Coincidence? I think not. However, it does lend a little slant to the model, which is a good thing. I am a fan of needful complication. A. From carbonnb at gmail.com Fri Jan 12 16:05:54 2007 From: carbonnb at gmail.com (Bryan Carbonnell) Date: Fri, 12 Jan 2007 17:05:54 -0500 Subject: [dba-SQLServer] Holidays by Nation andState/Province/Canton/ etc. In-Reply-To: <20070112215824.10099.qmail@web88207.mail.re2.yahoo.com> References: <20070112215824.10099.qmail@web88207.mail.re2.yahoo.com> Message-ID: On 1/12/07, artful at rogers.com wrote: > So, the CBC works on the same schedule as most bars and taverns. Coincidence? I think not. However, it does lend a little slant to the model, which is a good thing. I am a fan of needful complication. Glad to help :) -- Bryan Carbonnell - carbonnb at gmail.com Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "What a great ride!" From artful at rogers.com Fri Jan 12 16:05:59 2007 From: artful at rogers.com (artful at rogers.com) Date: Fri, 12 Jan 2007 14:05:59 -0800 (PST) Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Message-ID: <20070112220559.84399.qmail@web88208.mail.re2.yahoo.com> Thanks for that input. But as far as I know the calculation for Easter is quite simple. The first Sunday after the first full moon in April. ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Friday, January 12, 2007 4:15:18 PM Subject: Re: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. Hi Arthur: The holidays for a specific region can be easily calculated and automated from years to year. The only really difficult calculation seems to be Easter. The problem that I found was that every region has it own way of interpreting holidays. North America alone would take a fair bit of research and internationally it could be a career move. The way I have traditionally handled holidays is to have a trigger, that rerun a section of code that repopulates the holiday table, at the beginning of the year and then various apps can refer to the definitive list. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Thursday, January 11, 2007 7:34 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. One assumes that BusinessDaysBetween (@d1, @d2) observes the Holidays table and also ignores Saturday and Sunday (which admittedly could be wrong, but let's at first keep it simple). So: Inputs are 01-01-2007 and 02-28-2007. Assume that Saturday and Sunday are not business days. (This subject to revision, but later.) Assume that there are two holidays in January, the 16th and the 25th (chosen arbitrarily, I grant you, although I made sure they weren't Saturday or Sunday, else the exercise would be pointless). Algorithm: Build a temp table consisting of the dates between x and y. Subtract the dates existing in our holidays table. Subtract the dates describing our weekends. Sum the remaining days. Return the count. Holes in the algorithm? Please point them out before I cast this in stone. TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From stuart at lexacorp.com.pg Fri Jan 12 21:28:31 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 13 Jan 2007 13:28:31 +1000 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. In-Reply-To: <20070112220559.84399.qmail@web88208.mail.re2.yahoo.com> References: <20070112220559.84399.qmail@web88208.mail.re2.yahoo.com> Message-ID: <45A851DF.15156.4021EA82@stuart.lexacorp.com.pg> Actually, it's the first Sunday after the first full moon on or after the northern hemisphere's vernal equinox. However, the "full moon" and "vernal equinox" are not the astronomical ones, they are simplified ecclesiastical ones. The standard way to calcuate Easter doesn't use information about full moons or equinoxes at all. It's called "the algorithm of Oudin" and relies solely on integer arithmetic on the year number to derive the month and day of Easter Sunday. For all the gory details, see http://aa.usno.navy.mil/faq/docs/easter.html On 12 Jan 2007 at 14:05, artful at rogers.com wrote: > Thanks for that input. But as far as I know the calculation for Easter is > quite simple. The first Sunday after the first full moon in April. -- Stuart From martyconnelly at shaw.ca Fri Jan 12 23:12:11 2007 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 12 Jan 2007 21:12:11 -0800 Subject: [dba-SQLServer] Holidays by Nation and State/Province/Canton/etc. In-Reply-To: <45A851DF.15156.4021EA82@stuart.lexacorp.com.pg> References: <20070112220559.84399.qmail@web88208.mail.re2.yahoo.com> <45A851DF.15156.4021EA82@stuart.lexacorp.com.pg> Message-ID: <45A86A2B.90605@shaw.ca> Oh it gets worse. Easter in Slavic countries is a different calculation based on the Julian calendar and Eastern Orthodox methods. This year they both fall on the same date, this happens around every seven years or so. Also their Christmas falls on January 7'th Then there is the Hijri calendar for moveable dates based on a lunar calendar. Stuart McLachlan wrote: >Actually, it's the first Sunday after the first full moon on or after the >northern hemisphere's vernal equinox. > >However, the "full moon" and "vernal equinox" are not the astronomical >ones, they are simplified ecclesiastical ones. > >The standard way to calcuate Easter doesn't use information about full >moons or equinoxes at all. It's called "the algorithm of Oudin" and relies >solely on integer arithmetic on the year number to derive the month and day >of Easter Sunday. > >For all the gory details, see http://aa.usno.navy.mil/faq/docs/easter.html > > > >On 12 Jan 2007 at 14:05, artful at rogers.com wrote: > > > > >>Thanks for that input. But as far as I know the calculation for Easter is >>quite simple. The first Sunday after the first full moon in April. >> >> -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Sat Jan 13 00:07:26 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sat, 13 Jan 2007 01:07:26 -0500 Subject: [dba-SQLServer] Excel zip imports Message-ID: <007b01c736d9$19ee76d0$657aa8c0@m6805> I imported a zip database into SQL Server from Excel. The data out in Excel is numeric (float according to the imported table). As a result the leading zeros were stripped off. Two questions, is it possible to format fields such as this with leading zeros as you import them (and if so how), and now that I have it in the database, how can I get the leading zeros back. I John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jan 13 08:02:18 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sat, 13 Jan 2007 09:02:18 -0500 Subject: [dba-SQLServer] Excel zip imports In-Reply-To: <007b01c736d9$19ee76d0$657aa8c0@m6805> Message-ID: <001901c7371b$705805d0$657aa8c0@m6805> Update - in the end it was easier (for me) to just go back to the spreadsheet, format the columns in question correctly (there is a "zip special format for example) and then export it to a CSV file, then import the CSV file. Worked without a hitch and I had it done within about 20 minutes for two Excel files. I'd still like to find an answer within SQL Server though. It seems something like the format(data,"format info") should be available but I cannot find anything like it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Saturday, January 13, 2007 1:07 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Excel zip imports I imported a zip database into SQL Server from Excel. The data out in Excel is numeric (float according to the imported table). As a result the leading zeros were stripped off. Two questions, is it possible to format fields such as this with leading zeros as you import them (and if so how), and now that I have it in the database, how can I get the leading zeros back. I John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jan 13 14:14:32 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sat, 13 Jan 2007 15:14:32 -0500 Subject: [dba-SQLServer] Bulk insert Message-ID: <002901c7374f$70d882d0$657aa8c0@m6805> I am trying to figure out bulk insert in order to import 27 csv files without using the wizard. I can and do use the wizard and it imports stuff flawlessly, but when I use bulk insert, every field is surrounded by "" - quotes on each side of the data. I am using FIELDTERMINATOR = "," (which was the first time it actually allowed the import) and FirstRow = 2 (to get rid of the CSV field names row). If I use DataFileType = 'CHAR' or not, the results appear to be identical. If I open the data in Wordpad, the data is indeed surrounded by double quotes "somedata", but if I use the import wizard, the double quotes are magically stripped out. Does anyone know the syntax I need to use to import a plain old CSV file, without ending up with the double quotes surrounding every data item after the import process? John W. Colby Colby Consulting www.ColbyConsulting.com From jlawrenc1 at shaw.ca Sat Jan 13 14:17:46 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Sat, 13 Jan 2007 12:17:46 -0800 Subject: [dba-SQLServer] Excel zip imports In-Reply-To: <001901c7371b$705805d0$657aa8c0@m6805> Message-ID: <0JBT00F4NPM5A1R0@l-daemon> Hi John: When moving data into the MS SQL application I use the DTS module to import the data into a raw table and then convert the data into the finished table. If you are using a single table with 2 fields then this would be a simple answer. Update MyTable Set myCharacterField = right('0000000000'+cast(MyNumericField as varchar(10)),10) The above example will take a field with a numeric value of 1234 and deposit 0000001234 in a character field. Just use CAST to set data type and RIGHT to pad results. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Saturday, January 13, 2007 6:02 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Excel zip imports Update - in the end it was easier (for me) to just go back to the spreadsheet, format the columns in question correctly (there is a "zip special format for example) and then export it to a CSV file, then import the CSV file. Worked without a hitch and I had it done within about 20 minutes for two Excel files. I'd still like to find an answer within SQL Server though. It seems something like the format(data,"format info") should be available but I cannot find anything like it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Saturday, January 13, 2007 1:07 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Excel zip imports I imported a zip database into SQL Server from Excel. The data out in Excel is numeric (float according to the imported table). As a result the leading zeros were stripped off. Two questions, is it possible to format fields such as this with leading zeros as you import them (and if so how), and now that I have it in the database, how can I get the leading zeros back. I John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sat Jan 13 14:27:11 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sat, 13 Jan 2007 15:27:11 -0500 Subject: [dba-SQLServer] Excel zip imports In-Reply-To: <0JBT00F4NPM5A1R0@l-daemon> Message-ID: <002e01c73751$34effc10$657aa8c0@m6805> Thanks! I don't need it now but I will again someday. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Saturday, January 13, 2007 3:18 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Excel zip imports Hi John: When moving data into the MS SQL application I use the DTS module to import the data into a raw table and then convert the data into the finished table. If you are using a single table with 2 fields then this would be a simple answer. Update MyTable Set myCharacterField = right('0000000000'+cast(MyNumericField as varchar(10)),10) The above example will take a field with a numeric value of 1234 and deposit 0000001234 in a character field. Just use CAST to set data type and RIGHT to pad results. HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Saturday, January 13, 2007 6:02 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Excel zip imports Update - in the end it was easier (for me) to just go back to the spreadsheet, format the columns in question correctly (there is a "zip special format for example) and then export it to a CSV file, then import the CSV file. Worked without a hitch and I had it done within about 20 minutes for two Excel files. I'd still like to find an answer within SQL Server though. It seems something like the format(data,"format info") should be available but I cannot find anything like it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Saturday, January 13, 2007 1:07 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Excel zip imports I imported a zip database into SQL Server from Excel. The data out in Excel is numeric (float according to the imported table). As a result the leading zeros were stripped off. Two questions, is it possible to format fields such as this with leading zeros as you import them (and if so how), and now that I have it in the database, how can I get the leading zeros back. I John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jan 14 21:49:28 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 14 Jan 2007 22:49:28 -0500 Subject: [dba-SQLServer] deduplication Message-ID: <007801c73858$28f96920$657aa8c0@m6805> Is there a SQL syntax or method for identifying duplicate records based on and automatically removing (or marking) the second and subsequent instances of that record. I am working with a database where there may be several records for the same person. Each record will have slightly different data in the record. I need to find all the records for a given person, remove or somehow flag the "duplicate" records, and eventually "merge" the duplicate records together. I know how to use groupby and count to find the dupes but I don't really know how to then merge fields F through M from records 2,3 and 4 back into fields F through M in record 1. This is going to be an ongoing project so I need to learn the methodology to get it done. I can do it with recordsets and code, but not with SQL, and given the large potential numbers of records SQL would be my first choice. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sun Jan 14 22:04:38 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 14 Jan 2007 23:04:38 -0500 Subject: [dba-SQLServer] Errors importing CSV Message-ID: <007d01c7385a$47331290$657aa8c0@m6805> I have several machines. One machine has SQl Server 2K installed, another has SQL Server 2005. I have a bunch of largish csv files, with ~2.1 million records each which I need to import. The SQL Server 2K database has always been able to import these things in the past, in fact still can import a certain subset of the files, but is consistently getting "missing field delimiter" at some point in the majority of these files. What record it says is bad varies from file to file, but is repeatable (same record) in any given file. These same files import just fine in SQL Server 2005, no errors at all. Is 2005 simply more forgiving, automatically dropping any records which have missing field delimiters, or is 2K screwing something up? I have done a bunch of these imports and suddenly am having problems. Any file with a problem always has the problem, and any file that imports successfully will always import successfully so I suspect that there are actual bad rows in the files. IK am using the wizard in all cases, 2K and 2005 John W. Colby Colby Consulting www.ColbyConsulting.com From stuart at lexacorp.com.pg Sun Jan 14 22:17:01 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Mon, 15 Jan 2007 14:17:01 +1000 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: <007d01c7385a$47331290$657aa8c0@m6805> References: <007d01c7385a$47331290$657aa8c0@m6805> Message-ID: <45AB8CDD.22273.915DCE@stuart.lexacorp.com.pg> First thing I'd do is open a problem CSV file in something like NoteTab or Crimson Editor. Take a close look at the first line which is throwing a problem. That should tell you what is causing it and you can take necessary corrective action. On 14 Jan 2007 at 23:04, JWColby wrote: > I have several machines. One machine has SQl Server 2K installed, another > has SQL Server 2005. I have a bunch of largish csv files, with ~2.1 million > records each which I need to import. The SQL Server 2K database has always > been able to import these things in the past, in fact still can import a > certain subset of the files, but is consistently getting "missing field > delimiter" at some point in the majority of these files. What record it > says is bad varies from file to file, but is repeatable (same record) in any > given file. > > These same files import just fine in SQL Server 2005, no errors at all. > > Is 2005 simply more forgiving, automatically dropping any records which have > missing field delimiters, or is 2K screwing something up? I have done a > bunch of these imports and suddenly am having problems. Any file with a > problem always has the problem, and any file that imports successfully will > always import successfully so I suspect that there are actual bad rows in > the files. > > IK am using the wizard in all cases, 2K and 2005 > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From markamatte at hotmail.com Mon Jan 15 09:39:56 2007 From: markamatte at hotmail.com (Mark A Matte) Date: Mon, 15 Jan 2007 15:39:56 +0000 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: <45AB8CDD.22273.915DCE@stuart.lexacorp.com.pg> Message-ID: I do something similar...but my files are close to/over a gig and I can't open them with the text editors I have access to....so I link to the file with access to see the data in the messed up row, isolate the problem...then I use VBA to loop through chunks of the file, fix the isolated problem, and write the chunks out to a new file. Might be aroundabout...but works. Thanks, Mark A. Matte >From: "Stuart McLachlan" >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Errors importing CSV >Date: Mon, 15 Jan 2007 14:17:01 +1000 > >First thing I'd do is open a problem CSV file in something like NoteTab or >Crimson Editor. >Take a close look at the first line which is throwing a problem. >That should tell you what is causing it and you can take necessary >corrective action. > > > >On 14 Jan 2007 at 23:04, JWColby wrote: > > > I have several machines. One machine has SQl Server 2K installed, >another > > has SQL Server 2005. I have a bunch of largish csv files, with ~2.1 >million > > records each which I need to import. The SQL Server 2K database has >always > > been able to import these things in the past, in fact still can import a > > certain subset of the files, but is consistently getting "missing field > > delimiter" at some point in the majority of these files. What record it > > says is bad varies from file to file, but is repeatable (same record) in >any > > given file. > > > > These same files import just fine in SQL Server 2005, no errors at all. > > > > Is 2005 simply more forgiving, automatically dropping any records which >have > > missing field delimiters, or is 2K screwing something up? I have done a > > bunch of these imports and suddenly am having problems. Any file with a > > problem always has the problem, and any file that imports successfully >will > > always import successfully so I suspect that there are actual bad rows >in > > the files. > > > > IK am using the wizard in all cases, 2K and 2005 > > > > John W. Colby > > Colby Consulting > > www.ColbyConsulting.com > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ Dave vs. Carl: The Insignificant Championship Series. ?Who will win? http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://davevscarl.spaces.live.com/?icid=T001MSN38C07001 From rl_stewart at highstream.net Mon Jan 15 13:22:02 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Mon, 15 Jan 2007 13:22:02 -0600 Subject: [dba-SQLServer] deduplication In-Reply-To: References: Message-ID: <200701151924.l0FJOoR23330@databaseadvisors.com> John, take a look at cursors. They operate like recordsets do in Access. If you know how to do it in Access with a recordset, you can do the same with a cursor in SQL Server. Robert At 12:00 PM 1/15/2007, you wrote: >Date: Sun, 14 Jan 2007 22:49:28 -0500 >From: "JWColby" >Subject: [dba-SQLServer] deduplication >To: "'Access Developers discussion and problem solving'" > , >Message-ID: <007801c73858$28f96920$657aa8c0 at m6805> >Content-Type: text/plain; charset="us-ascii" > >Is there a SQL syntax or method for identifying duplicate records based on >and automatically removing (or marking) the second and subsequent instances >of that record. > >I am working with a database where there may be several records for the same >person. Each record will have slightly different data in the record. I >need to find all the records for a given person, remove or somehow flag the >"duplicate" records, and eventually "merge" the duplicate records together. > > >I know how to use groupby and count to find the dupes but I don't really >know how to then merge fields F through M from records 2,3 and 4 back into >fields F through M in record 1. This is going to be an ongoing project so I >need to learn the methodology to get it done. I can do it with recordsets >and code, but not with SQL, and given the large potential numbers of records >SQL would be my first choice. > >John W. Colby >Colby Consulting >www.ColbyConsulting.com From stuart at lexacorp.com.pg Mon Jan 15 16:07:35 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 16 Jan 2007 08:07:35 +1000 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: References: <45AB8CDD.22273.915DCE@stuart.lexacorp.com.pg>, Message-ID: <45ABFB27.30852.88F35D4@stuart.lexacorp.com.pg> On 15 Jan 2007 at 15:39, Mark A Matte wrote: > I do something similar...but my files are close to/over a gig and I can't > open them with the text editors I have access to.... Grab a copy of NoteTab Lite or Crimson Editor off the Web. They're both freeware and can handle 2 GB files. -- Stuart From markamatte at hotmail.com Tue Jan 16 09:06:43 2007 From: markamatte at hotmail.com (Mark A Matte) Date: Tue, 16 Jan 2007 15:06:43 +0000 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: <45ABFB27.30852.88F35D4@stuart.lexacorp.com.pg> Message-ID: Stuart, I tried Notetab lite before...and it couldn't handle the files. I haven't tried Crimson...I'll give it a look. Thanks, Mark >From: "Stuart McLachlan" >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Errors importing CSV >Date: Tue, 16 Jan 2007 08:07:35 +1000 > >On 15 Jan 2007 at 15:39, Mark A Matte wrote: > > > I do something similar...but my files are close to/over a gig and I >can't > > open them with the text editors I have access to.... > >Grab a copy of NoteTab Lite or Crimson Editor off the Web. >They're both freeware and can handle 2 GB files. > >-- >Stuart > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ Get live scores and news about your team: Add the Live.com Football Page www.live.com/?addtemplate=football&icid=T001MSN30A0701 From shait at mindspring.com Tue Jan 16 11:11:40 2007 From: shait at mindspring.com (Stephen Hait) Date: Tue, 16 Jan 2007 12:11:40 -0500 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: References: <45ABFB27.30852.88F35D4@stuart.lexacorp.com.pg> Message-ID: > I tried Notetab lite before...and it couldn't handle the files. I haven't > tried Crimson...I'll give it a look. You might also look at EditPad Pro for easily editing large (multi-gig) files. Free demo available at editpadpro.com. Stephen From stuart at lexacorp.com.pg Tue Jan 16 16:42:42 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 17 Jan 2007 08:42:42 +1000 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: References: <45ABFB27.30852.88F35D4@stuart.lexacorp.com.pg>, Message-ID: <45ADE182.1170.9AC02E3@stuart.lexacorp.com.pg> On 16 Jan 2007 at 15:06, Mark A Matte wrote: > Stuart, > > I tried Notetab lite before...and it couldn't handle the files. I haven't > tried Crimson...I'll give it a look. If you just want to look at the file and not edit it, try "Large Text File Viewer" from http://www.swiftgear.com/ From jwcolby at colbyconsulting.com Tue Jan 16 17:07:41 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Tue, 16 Jan 2007 18:07:41 -0500 Subject: [dba-SQLServer] Errors importing CSV In-Reply-To: <45ADE182.1170.9AC02E3@stuart.lexacorp.com.pg> Message-ID: <007801c739c3$202e9c40$657aa8c0@m6805> And I use ultraedit. It can handle very wide files, large numbers of lines, and has a ruler for seeing the position across the file. It is not free, but it is cheap. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Tuesday, January 16, 2007 5:43 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Errors importing CSV On 16 Jan 2007 at 15:06, Mark A Matte wrote: > Stuart, > > I tried Notetab lite before...and it couldn't handle the files. I > haven't tried Crimson...I'll give it a look. If you just want to look at the file and not edit it, try "Large Text File Viewer" from http://www.swiftgear.com/ _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael at ddisolutions.com.au Tue Jan 16 20:45:44 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Wed, 17 Jan 2007 13:45:44 +1100 Subject: [dba-SQLServer] Errors importing CSV Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE3@ddi-01.DDI.local> Notepad++ is free. Havnt found a file it couldn't open yet. Don't know any size limit. Supports macros + colour coding of code, line numbering etc etc Michael M -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Wednesday, 17 January 2007 10:08 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Errors importing CSV And I use ultraedit. It can handle very wide files, large numbers of lines, and has a ruler for seeing the position across the file. It is not free, but it is cheap. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Tuesday, January 16, 2007 5:43 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Errors importing CSV On 16 Jan 2007 at 15:06, Mark A Matte wrote: > Stuart, > > I tried Notetab lite before...and it couldn't handle the files. I > haven't tried Crimson...I'll give it a look. If you just want to look at the file and not edit it, try "Large Text File Viewer" from http://www.swiftgear.com/ _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Tue Jan 16 21:31:47 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Wed, 17 Jan 2007 16:31:47 +1300 Subject: [dba-SQLServer] Accessing Tables in another server Message-ID: <20070117032911.RCLR17747.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> SQL2000. I have two servers registered in enterprise manager. I would like to run a stored procedure from a database on one server which gets data from a table on the second server. For example, assuming we have: Stored Procedure1 in database1 on server 1 Table2 in Database2 on Server 2 I would like to do something like this in Database1 Select * From Server2.Database2.dbo.Table2 The error message I get when trying to save the procedure is "The number name contains more than the maximum number of prefixes. The maximum is three." How can I reference the data on the other server? Regards David Emerson Dalyn Software Ltd Wellington, New Zealand From artful at rogers.com Tue Jan 16 22:00:15 2007 From: artful at rogers.com (artful at rogers.com) Date: Tue, 16 Jan 2007 20:00:15 -0800 (PST) Subject: [dba-SQLServer] Accessing Tables in another server Message-ID: <20070117040015.62960.qmail@web88205.mail.re2.yahoo.com> Try establishing Server2 as a linked server. Try referencing S2's table as \\S2\database\table. Let me know if these go wrong. I can do this. I may need to know your specific names, etc. That said, there are certain things you cannot do, such as use RI across databases. Bummer, but that is the case (AFAIK). ----- Original Message ---- From: David Emerson To: dba-SQLServer at databaseadvisors.com Sent: Tuesday, January 16, 2007 10:31:47 PM Subject: [dba-SQLServer] Accessing Tables in another server SQL2000. I have two servers registered in enterprise manager. I would like to run a stored procedure from a database on one server which gets data from a table on the second server. For example, assuming we have: Stored Procedure1 in database1 on server 1 Table2 in Database2 on Server 2 I would like to do something like this in Database1 Select * From Server2.Database2.dbo.Table2 The error message I get when trying to save the procedure is "The number name contains more than the maximum number of prefixes. The maximum is three." How can I reference the data on the other server? Regards David Emerson Dalyn Software Ltd Wellington, New Zealand _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Tue Jan 16 22:11:57 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Wed, 17 Jan 2007 17:11:57 +1300 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <20070117040015.62960.qmail@web88205.mail.re2.yahoo.com> References: <20070117040015.62960.qmail@web88205.mail.re2.yahoo.com> Message-ID: <20070117040953.WJWF6299.fep05.xtra.co.nz@Dalyn.dalyn.co.nz> Thanks Arthur, I thought it would be already linked if it was showing in Enterprise Manager as a registered server. Is there a step I am missing? David At 17/01/2007, you wrote: >Try establishing Server2 as a linked server. >Try referencing S2's table as \\S2\database\table. > >Let me know if these go wrong. I can do this. I may need to know >your specific names, etc. > >That said, there are certain things you cannot do, such as use RI >across databases. Bummer, but that is the case (AFAIK). > >----- Original Message ---- >From: David Emerson >To: dba-SQLServer at databaseadvisors.com >Sent: Tuesday, January 16, 2007 10:31:47 PM >Subject: [dba-SQLServer] Accessing Tables in another server > >SQL2000. > >I have two servers registered in enterprise manager. I would like to >run a stored procedure from a database on one server which gets data >from a table on the second server. For example, assuming we have: > >Stored Procedure1 in database1 on server 1 >Table2 in Database2 on Server 2 > >I would like to do something like this in Database1 > >Select * > From Server2.Database2.dbo.Table2 > >The error message I get when trying to save the procedure is "The >number name contains more than the maximum number of prefixes. The >maximum is three." > >How can I reference the data on the other server? > >Regards > >David Emerson >Dalyn Software Ltd >Wellington, New Zealand > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > > > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com From michael at ddisolutions.com.au Tue Jan 16 22:24:50 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Wed, 17 Jan 2007 15:24:50 +1100 Subject: [dba-SQLServer] Accessing Tables in another server Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE5@ddi-01.DDI.local> In EM Security --> Linked Servers cheers Michael M -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Emerson Sent: Wednesday, 17 January 2007 3:12 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Accessing Tables in another server Thanks Arthur, I thought it would be already linked if it was showing in Enterprise Manager as a registered server. Is there a step I am missing? David At 17/01/2007, you wrote: >Try establishing Server2 as a linked server. >Try referencing S2's table as \\S2\database\table. > >Let me know if these go wrong. I can do this. I may need to know your >specific names, etc. > >That said, there are certain things you cannot do, such as use RI >across databases. Bummer, but that is the case (AFAIK). > >----- Original Message ---- >From: David Emerson >To: dba-SQLServer at databaseadvisors.com >Sent: Tuesday, January 16, 2007 10:31:47 PM >Subject: [dba-SQLServer] Accessing Tables in another server > >SQL2000. > >I have two servers registered in enterprise manager. I would like to >run a stored procedure from a database on one server which gets data >from a table on the second server. For example, assuming we have: > >Stored Procedure1 in database1 on server 1 >Table2 in Database2 on Server 2 > >I would like to do something like this in Database1 > >Select * > From Server2.Database2.dbo.Table2 > >The error message I get when trying to save the procedure is "The >number name contains more than the maximum number of prefixes. The >maximum is three." > >How can I reference the data on the other server? > >Regards > >David Emerson >Dalyn Software Ltd >Wellington, New Zealand > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > > > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Tue Jan 16 21:31:47 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Wed, 17 Jan 2007 16:31:47 +1300 Subject: [dba-SQLServer] Accessing Tables in another server Message-ID: <20070117032911.RCLR17747.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> SQL2000. I have two servers registered in enterprise manager. I would like to run a stored procedure from a database on one server which gets data from a table on the second server. For example, assuming we have: Stored Procedure1 in database1 on server 1 Table2 in Database2 on Server 2 I would like to do something like this in Database1 Select * From Server2.Database2.dbo.Table2 The error message I get when trying to save the procedure is "The number name contains more than the maximum number of prefixes. The maximum is three." How can I reference the data on the other server? Regards David Emerson Dalyn Software Ltd Wellington, New Zealand From jwcolby at colbyconsulting.com Wed Jan 17 07:47:49 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 17 Jan 2007 08:47:49 -0500 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <20070117032911.RCLR17747.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: <008801c73a3e$1450a000$657aa8c0@m6805> I have the same question basically. On one of my machines, I have a database in SQL Server 2K and another database in Sql Server 2005. I need to create new tables in SQL Server 2005 and copy the data from SQL Server 2K into the new tables. I tried using a select fld1,fld2,etc, from [servername].[databasename].[dbo].[tablename] but that failed. Is there a syntax like this that can be used? How do you select data into a dataset which physically resides on another server? It seems like a normal thing to do. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Emerson Sent: Tuesday, January 16, 2007 10:32 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer] Accessing Tables in another server SQL2000. I have two servers registered in enterprise manager. I would like to run a stored procedure from a database on one server which gets data from a table on the second server. For example, assuming we have: Stored Procedure1 in database1 on server 1 Table2 in Database2 on Server 2 I would like to do something like this in Database1 Select * From Server2.Database2.dbo.Table2 The error message I get when trying to save the procedure is "The number name contains more than the maximum number of prefixes. The maximum is three." How can I reference the data on the other server? Regards David Emerson Dalyn Software Ltd Wellington, New Zealand _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Wed Jan 17 07:59:06 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 17 Jan 2007 08:59:06 -0500 Subject: [dba-SQLServer] Multi-field vs field indexes Message-ID: <008901c73a3f$a81e30d0$657aa8c0@m6805> Can someone write (or point to) a description of single field vs multi-field indexes. Let's take an example of city/state/zip. If I created a single index for all three of these fields, would the index be useful for the individual fields as well. If I were to do a join on Zip, would the multi-field index be used to select the zips for the join or would a single field zip index be needed in such a case? John W. Colby Colby Consulting www.ColbyConsulting.com From fhtapia at gmail.com Wed Jan 17 10:28:55 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 17 Jan 2007 08:28:55 -0800 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <008801c73a3e$1450a000$657aa8c0@m6805> References: <20070117032911.RCLR17747.fep06.xtra.co.nz@Dalyn.dalyn.co.nz> <008801c73a3e$1450a000$657aa8c0@m6805> Message-ID: If this is a continuous process then you want to create the linked server as stated earlier in the thread, but if this is a one time job, you can get away w/ ETL'ing (used to be DTS). -- Francisco On 1/17/07, JWColby wrote: > I have the same question basically. On one of my machines, I have a > database in SQL Server 2K and another database in Sql Server 2005. I need > to create new tables in SQL Server 2005 and copy the data from SQL Server 2K > into the new tables. > > I tried using a select fld1,fld2,etc, from > [servername].[databasename].[dbo].[tablename] but that failed. Is there a > syntax like this that can be used? How do you select data into a dataset > which physically resides on another server? It seems like a normal thing to > do. > > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David > Emerson > Sent: Tuesday, January 16, 2007 10:32 PM > To: dba-SQLServer at databaseadvisors.com > Subject: [dba-SQLServer] Accessing Tables in another server > > SQL2000. > > I have two servers registered in enterprise manager. I would like to run a > stored procedure from a database on one server which gets data from a table > on the second server. For example, assuming we have: > > Stored Procedure1 in database1 on server 1 > Table2 in Database2 on Server 2 > > I would like to do something like this in Database1 > > Select * > From Server2.Database2.dbo.Table2 > > The error message I get when trying to save the procedure is "The number > name contains more than the maximum number of prefixes. The maximum is > three." > > How can I reference the data on the other server? > > Regards > > David Emerson > Dalyn Software Ltd > Wellington, New Zealand > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From newsgrps at dalyn.co.nz Wed Jan 17 13:50:15 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 18 Jan 2007 08:50:15 +1300 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE5@ddi-01.DDI.local> References: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE5@ddi-01.DDI.local> Message-ID: <20070117194830.KFTS29845.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> OK, we are getting closer. I created a linked server in EM. In the linked Server General tab I put the server name, selected SQL server as the server type, and use logins current security context on the security tab. The linked sever created ok but when I look at the tables in EM it only shows them for one database. I actually have two databases on that server that I want to be able to link to. I can see all databases in the server registration area. How can I make tables from both databases available? David At 17/01/2007, you wrote: >In EM >Security --> Linked Servers > >cheers > >Michael M >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David >Emerson >Sent: Wednesday, 17 January 2007 3:12 PM >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Accessing Tables in another server > >Thanks Arthur, > >I thought it would be already linked if it was showing in Enterprise >Manager as a registered server. Is there a step I am missing? > >David > >At 17/01/2007, you wrote: > >Try establishing Server2 as a linked server. > >Try referencing S2's table as \\S2\database\table. > > > >Let me know if these go wrong. I can do this. I may need to know your > >specific names, etc. > > > >That said, there are certain things you cannot do, such as use RI > >across databases. Bummer, but that is the case (AFAIK). > > > >----- Original Message ---- > >From: David Emerson > >To: dba-SQLServer at databaseadvisors.com > >Sent: Tuesday, January 16, 2007 10:31:47 PM > >Subject: [dba-SQLServer] Accessing Tables in another server > > > >SQL2000. > > > >I have two servers registered in enterprise manager. I would like to > >run a stored procedure from a database on one server which gets data > >from a table on the second server. For example, assuming we have: > > > >Stored Procedure1 in database1 on server 1 > >Table2 in Database2 on Server 2 > > > >I would like to do something like this in Database1 > > > >Select * > > From Server2.Database2.dbo.Table2 > > > >The error message I get when trying to save the procedure is "The > >number name contains more than the maximum number of prefixes. The > >maximum is three." > > > >How can I reference the data on the other server? > > > >Regards > > > >David Emerson > >Dalyn Software Ltd > >Wellington, New Zealand > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > > > > > > > > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Wed Jan 17 17:30:29 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 18 Jan 2007 12:30:29 +1300 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <20070117194830.KFTS29845.fep02.xtra.co.nz@Dalyn.dalyn.co.n z> References: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE5@ddi-01.DDI.local> <20070117194830.KFTS29845.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: <20070117232903.GCNS14593.fep05.xtra.co.nz@Dalyn.dalyn.co.nz> I managed to get separate linked servers for each database by setting the server type to Other Data Source, selecting Microsoft OLD DB Provider for SQL Server as the provider name, setting the data source to JOHNSONVILLE (the name of the server), and setting the provider string to: DRIVER=SQL Server;Server=JOHNSONVILLE;APP=Microsoft Open Database Connectivity;DATABASE=mySQLbe;UID=sa Now in the linked servers details I can see the correct tables and views. One of the linked servers is called JVILLE2000. However I still am having troubles accessing the data. If I have this in a stored procedure (or even in Query Analyser): SELECT JVILLE2000.dbo.ttmpLoadAllocatAllLoads.YrMth FROM JVILLE2000.dbo.ttmpLoadAllocatAllLoads I get an error - Invalid object name 'JVILLE2000.dbo.ttmpLoadAllocatAllLoads' If I try: SELECT JVILLE2000.egasSQLbe.dbo.ttmpLoadAllocatAllLoads.YrMth FROM JVILLE2000.egasSQLbe.dbo.ttmpLoadAllocatAllLoads The number name 'JVILLE2000.mySQLbe.dbo.ttmpLoadAllocatAllLoads' contains more than the maximum number of prefixes. The maximum is 3. How do I access the data in the linked servers? David At 18/01/2007, you wrote: >OK, we are getting closer. I created a linked server in EM. In the >linked Server General tab I put the server name, selected SQL server >as the server type, and use logins current security context on the >security tab. The linked sever created ok but when I look at the >tables in EM it only shows them for one database. I actually have >two databases on that server that I want to be able to link to. I >can see all databases in the server registration area. > >How can I make tables from both databases available? > >David > >At 17/01/2007, you wrote: > >In EM > >Security --> Linked Servers > > > >cheers > > > >Michael M > >-----Original Message----- > >From: dba-sqlserver-bounces at databaseadvisors.com > >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David > >Emerson > >Sent: Wednesday, 17 January 2007 3:12 PM > >To: dba-sqlserver at databaseadvisors.com > >Subject: Re: [dba-SQLServer] Accessing Tables in another server > > > >Thanks Arthur, > > > >I thought it would be already linked if it was showing in Enterprise > >Manager as a registered server. Is there a step I am missing? > > > >David > > > >At 17/01/2007, you wrote: > > >Try establishing Server2 as a linked server. > > >Try referencing S2's table as \\S2\database\table. > > > > > >Let me know if these go wrong. I can do this. I may need to know your > > >specific names, etc. > > > > > >That said, there are certain things you cannot do, such as use RI > > >across databases. Bummer, but that is the case (AFAIK). > > > > > >----- Original Message ---- > > >From: David Emerson > > >To: dba-SQLServer at databaseadvisors.com > > >Sent: Tuesday, January 16, 2007 10:31:47 PM > > >Subject: [dba-SQLServer] Accessing Tables in another server > > > > > >SQL2000. > > > > > >I have two servers registered in enterprise manager. I would like to > > >run a stored procedure from a database on one server which gets data > > >from a table on the second server. For example, assuming we have: > > > > > >Stored Procedure1 in database1 on server 1 > > >Table2 in Database2 on Server 2 > > > > > >I would like to do something like this in Database1 > > > > > >Select * > > > From Server2.Database2.dbo.Table2 > > > > > >The error message I get when trying to save the procedure is "The > > >number name contains more than the maximum number of prefixes. The > > >maximum is three." > > > > > >How can I reference the data on the other server? > > > > > >Regards > > > > > >David Emerson > > >Dalyn Software Ltd > > >Wellington, New Zealand From jwcolby at colbyconsulting.com Wed Jan 17 20:25:33 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 17 Jan 2007 21:25:33 -0500 Subject: [dba-SQLServer] SQL Server memory hog Message-ID: <00c801c73aa7$eeec9520$657aa8c0@m6805> Someone mentioned that SQL Server will ask for and retain all available memory, and MS documentation (and the behavior of SQL Server itself) bears this out. I am installing VS.net on my laptop. It installs the small (free) express version of SQL Server 2005. Does it likewise consume all available memory? If so will my laptop be able to function as a programming machine while using SQL Server express as the data store? John W. Colby Colby Consulting www.ColbyConsulting.com From accessd at shaw.ca Thu Jan 18 00:51:05 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Wed, 17 Jan 2007 22:51:05 -0800 Subject: [dba-SQLServer] SQL Server memory hog In-Reply-To: <00c801c73aa7$eeec9520$657aa8c0@m6805> Message-ID: <0JC100BG0XM1CAK0@l-daemon> Hi John: Simple answer is 'Yes'... I am doing this as I email. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Wednesday, January 17, 2007 6:26 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Server memory hog Someone mentioned that SQL Server will ask for and retain all available memory, and MS documentation (and the behavior of SQL Server itself) bears this out. I am installing VS.net on my laptop. It installs the small (free) express version of SQL Server 2005. Does it likewise consume all available memory? If so will my laptop be able to function as a programming machine while using SQL Server express as the data store? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From paul.hartland at fsmail.net Thu Jan 18 05:01:54 2007 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Thu, 18 Jan 2007 12:01:54 +0100 (CET) Subject: [dba-SQLServer] SQL Server - Make Date Field Display 2 Digit Year Only Message-ID: <20389518.198761169118114607.JavaMail.www@wwinf3004.me-wanadoo.net> To all, I have a date field in a table in SQL Server 2000, which displays the date as DD/MM/YYYY. Does anyone know how to make the date field just hold a 2 digit year DD/MM/YY ? Thanks in advance for any help on this. Paul Hartland paul.hartland at fsmail.net 07730 523179 From fhtapia at gmail.com Thu Jan 18 12:37:34 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 18 Jan 2007 10:37:34 -0800 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <20070117194830.KFTS29845.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> References: <59A61174B1F5B54B97FD4ADDE71E7D0116AEE5@ddi-01.DDI.local> <20070117194830.KFTS29845.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: Once linked you can reference any database and table in the linked server so long as you have access so the syntax would look like this SELECT * FROM LinkedServerName.Database.dbo.TableName On 1/17/07, David Emerson wrote: > OK, we are getting closer. I created a linked server in EM. In the > linked Server General tab I put the server name, selected SQL server > as the server type, and use logins current security context on the > security tab. The linked sever created ok but when I look at the > tables in EM it only shows them for one database. I actually have > two databases on that server that I want to be able to link to. I > can see all databases in the server registration area. > > How can I make tables from both databases available? > > David > > At 17/01/2007, you wrote: > >In EM > >Security --> Linked Servers > > > >cheers > > > >Michael M > >-----Original Message----- > >From: dba-sqlserver-bounces at databaseadvisors.com > >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David > >Emerson > >Sent: Wednesday, 17 January 2007 3:12 PM > >To: dba-sqlserver at databaseadvisors.com > >Subject: Re: [dba-SQLServer] Accessing Tables in another server > > > >Thanks Arthur, > > > >I thought it would be already linked if it was showing in Enterprise > >Manager as a registered server. Is there a step I am missing? > > > >David > > > >At 17/01/2007, you wrote: > > >Try establishing Server2 as a linked server. > > >Try referencing S2's table as \\S2\database\table. > > > > > >Let me know if these go wrong. I can do this. I may need to know your > > >specific names, etc. > > > > > >That said, there are certain things you cannot do, such as use RI > > >across databases. Bummer, but that is the case (AFAIK). > > > > > >----- Original Message ---- > > >From: David Emerson > > >To: dba-SQLServer at databaseadvisors.com > > >Sent: Tuesday, January 16, 2007 10:31:47 PM > > >Subject: [dba-SQLServer] Accessing Tables in another server > > > > > >SQL2000. > > > > > >I have two servers registered in enterprise manager. I would like to > > >run a stored procedure from a database on one server which gets data > > >from a table on the second server. For example, assuming we have: > > > > > >Stored Procedure1 in database1 on server 1 > > >Table2 in Database2 on Server 2 > > > > > >I would like to do something like this in Database1 > > > > > >Select * > > > From Server2.Database2.dbo.Table2 > > > > > >The error message I get when trying to save the procedure is "The > > >number name contains more than the maximum number of prefixes. The > > >maximum is three." > > > > > >How can I reference the data on the other server? > > > > > >Regards > > > > > >David Emerson > > >Dalyn Software Ltd > > >Wellington, New Zealand > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From rl_stewart at highstream.net Thu Jan 18 12:36:41 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Thu, 18 Jan 2007 12:36:41 -0600 Subject: [dba-SQLServer] SQL Server - Make Date Field Display 2 Digit Year In-Reply-To: References: Message-ID: <200701181838.l0IIc0R01928@databaseadvisors.com> convert(YourDate,varchar(15),1) At 12:00 PM 1/18/2007, you wrote: >Date: Thu, 18 Jan 2007 12:01:54 +0100 (CET) >From: paul.hartland at fsmail.net >Subject: [dba-SQLServer] SQL Server - Make Date Field Display 2 Digit > Year Only >To: accessd , dba-sqlserver > >Message-ID: > <20389518.198761169118114607.JavaMail.www at wwinf3004.me-wanadoo.net> >Content-Type: text/plain; charset=UTF-8 > >To all, > >I have a date field in a table in SQL Server 2000, which displays >the date as DD/MM/YYYY. Does anyone know how to make the date field >just hold a 2 digit year DD/MM/YY ? > >Thanks in advance for any help on this. > > >Paul Hartland >paul.hartland at fsmail.net >07730 523179 From jwcolby at colbyconsulting.com Thu Jan 18 12:55:16 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Thu, 18 Jan 2007 13:55:16 -0500 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: Message-ID: <002d01c73b32$325c1e90$657aa8c0@m6805> That holds for views as well? John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia Sent: Thursday, January 18, 2007 1:38 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Accessing Tables in another server Once linked you can reference any database and table in the linked server so long as you have access so the syntax would look like this SELECT * FROM LinkedServerName.Database.dbo.TableName On 1/17/07, David Emerson wrote: > OK, we are getting closer. I created a linked server in EM. In the > linked Server General tab I put the server name, selected SQL server > as the server type, and use logins current security context on the > security tab. The linked sever created ok but when I look at the > tables in EM it only shows them for one database. I actually have two > databases on that server that I want to be able to link to. I can see > all databases in the server registration area. > > How can I make tables from both databases available? > > David > > At 17/01/2007, you wrote: > >In EM > >Security --> Linked Servers > > > >cheers > > > >Michael M > >-----Original Message----- > >From: dba-sqlserver-bounces at databaseadvisors.com > >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > >David Emerson > >Sent: Wednesday, 17 January 2007 3:12 PM > >To: dba-sqlserver at databaseadvisors.com > >Subject: Re: [dba-SQLServer] Accessing Tables in another server > > > >Thanks Arthur, > > > >I thought it would be already linked if it was showing in Enterprise > >Manager as a registered server. Is there a step I am missing? > > > >David > > > >At 17/01/2007, you wrote: > > >Try establishing Server2 as a linked server. > > >Try referencing S2's table as \\S2\database\table. > > > > > >Let me know if these go wrong. I can do this. I may need to know > > >your specific names, etc. > > > > > >That said, there are certain things you cannot do, such as use RI > > >across databases. Bummer, but that is the case (AFAIK). > > > > > >----- Original Message ---- > > >From: David Emerson > > >To: dba-SQLServer at databaseadvisors.com > > >Sent: Tuesday, January 16, 2007 10:31:47 PM > > >Subject: [dba-SQLServer] Accessing Tables in another server > > > > > >SQL2000. > > > > > >I have two servers registered in enterprise manager. I would like > > >to run a stored procedure from a database on one server which gets > > >data from a table on the second server. For example, assuming we have: > > > > > >Stored Procedure1 in database1 on server 1 > > >Table2 in Database2 on Server 2 > > > > > >I would like to do something like this in Database1 > > > > > >Select * > > > From Server2.Database2.dbo.Table2 > > > > > >The error message I get when trying to save the procedure is "The > > >number name contains more than the maximum number of prefixes. The > > >maximum is three." > > > > > >How can I reference the data on the other server? > > > > > >Regards > > > > > >David Emerson > > >Dalyn Software Ltd > > >Wellington, New Zealand > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > > >_______________________________________________ > >dba-SQLServer mailing list > >dba-SQLServer at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > >http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Thu Jan 18 12:59:24 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Thu, 18 Jan 2007 12:59:24 -0600 Subject: [dba-SQLServer] Text column truncating In-Reply-To: References: Message-ID: <200701181902.l0IJ2wR10534@databaseadvisors.com> All, I am trying to get a text data field to update in SQL 2000 using a stored procedure. CREATE PROCEDURE [dbo].[sp_SQL_addUpdate] @SQLUpdate_By nvarchar(25), @SQLUpdate_DB nvarchar(15), @SQLUpdate_Object nvarchar(50), @SQLUpdate_Description varchar(8000), @SQLUpdate_Script text, @SQLUpdate_ID int OUT AS DECLARE @ptrval binary(16) INSERT INTO dbo.tblSQLUpdates( SQLUpdate_By, SQLUpdate_DB, SQLUpdate_Object, SQLUpdate_Description ) VALUES ( @SQLUpdate_By, @SQLUpdate_DB, @SQLUpdate_Object, @SQLUpdate_Description ) SELECT @SQLUpdate_ID = @@Identity SELECT @ptrval = TEXTPTR(SQLUpdate_Script) FROM dbo.tblSQLUpdates WHERE SQLUpdate_ID = @SQLUpdate_ID WRITETEXT tblSQLUpdates.SQLUpdate_ID @ptrval @SQLUpdate_Script When writing the text back, I am getting a truncated value. My guess is that it is around 8000 characters. Anyone have any insight into it? Thanks, Robert From fhtapia at gmail.com Thu Jan 18 13:03:44 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 18 Jan 2007 11:03:44 -0800 Subject: [dba-SQLServer] Accessing Tables in another server In-Reply-To: <002d01c73b32$325c1e90$657aa8c0@m6805> References: <002d01c73b32$325c1e90$657aa8c0@m6805> Message-ID: Tables, Views, Stored Procedures, they all follow that format so long as you have rights . On 1/18/07, JWColby wrote: > That holds for views as well? > > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco > Tapia > Sent: Thursday, January 18, 2007 1:38 PM > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] Accessing Tables in another server > > Once linked you can reference any database and table in the linked server so > long as you have access so the syntax would look like this > > SELECT * FROM LinkedServerName.Database.dbo.TableName > > On 1/17/07, David Emerson wrote: > > OK, we are getting closer. I created a linked server in EM. In the > > linked Server General tab I put the server name, selected SQL server > > as the server type, and use logins current security context on the > > security tab. The linked sever created ok but when I look at the > > tables in EM it only shows them for one database. I actually have two > > databases on that server that I want to be able to link to. I can see > > all databases in the server registration area. > > > > How can I make tables from both databases available? > > > > David > > > > At 17/01/2007, you wrote: > > >In EM > > >Security --> Linked Servers > > > > > >cheers > > > > > >Michael M > > >-----Original Message----- > > >From: dba-sqlserver-bounces at databaseadvisors.com > > >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > > >David Emerson > > >Sent: Wednesday, 17 January 2007 3:12 PM > > >To: dba-sqlserver at databaseadvisors.com > > >Subject: Re: [dba-SQLServer] Accessing Tables in another server > > > > > >Thanks Arthur, > > > > > >I thought it would be already linked if it was showing in Enterprise > > >Manager as a registered server. Is there a step I am missing? > > > > > >David > > > > > >At 17/01/2007, you wrote: > > > >Try establishing Server2 as a linked server. > > > >Try referencing S2's table as \\S2\database\table. > > > > > > > >Let me know if these go wrong. I can do this. I may need to know > > > >your specific names, etc. > > > > > > > >That said, there are certain things you cannot do, such as use RI > > > >across databases. Bummer, but that is the case (AFAIK). > > > > > > > >----- Original Message ---- > > > >From: David Emerson > > > >To: dba-SQLServer at databaseadvisors.com > > > >Sent: Tuesday, January 16, 2007 10:31:47 PM > > > >Subject: [dba-SQLServer] Accessing Tables in another server > > > > > > > >SQL2000. > > > > > > > >I have two servers registered in enterprise manager. I would like > > > >to run a stored procedure from a database on one server which gets > > > >data from a table on the second server. For example, assuming we have: > > > > > > > >Stored Procedure1 in database1 on server 1 > > > >Table2 in Database2 on Server 2 > > > > > > > >I would like to do something like this in Database1 > > > > > > > >Select * > > > > From Server2.Database2.dbo.Table2 > > > > > > > >The error message I get when trying to save the procedure is "The > > > >number name contains more than the maximum number of prefixes. The > > > >maximum is three." > > > > > > > >How can I reference the data on the other server? > > > > > > > >Regards > > > > > > > >David Emerson > > > >Dalyn Software Ltd > > > >Wellington, New Zealand > > > > > > > >_______________________________________________ > > > >dba-SQLServer mailing list > > > >dba-SQLServer at databaseadvisors.com > > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > >http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > > > > > > > >_______________________________________________ > > > >dba-SQLServer mailing list > > > >dba-SQLServer at databaseadvisors.com > > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > >http://www.databaseadvisors.com > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > > > >_______________________________________________ > > >dba-SQLServer mailing list > > >dba-SQLServer at databaseadvisors.com > > >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > >http://www.databaseadvisors.com > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > -- > -Francisco > http://sqlthis.blogspot.com | Tsql and More... > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From michael at ddisolutions.com.au Thu Jan 18 18:47:29 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 19 Jan 2007 11:47:29 +1100 Subject: [dba-SQLServer] Text column truncating Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AEF5@ddi-01.DDI.local> Are you sure its not the viewer app that's truncating? If your testing in QA you can set the column width in options to show more then 8000 chars. Your code looks ok to me. cheers Michael M -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Friday, 19 January 2007 5:59 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Text column truncating All, I am trying to get a text data field to update in SQL 2000 using a stored procedure. CREATE PROCEDURE [dbo].[sp_SQL_addUpdate] @SQLUpdate_By nvarchar(25), @SQLUpdate_DB nvarchar(15), @SQLUpdate_Object nvarchar(50), @SQLUpdate_Description varchar(8000), @SQLUpdate_Script text, @SQLUpdate_ID int OUT AS DECLARE @ptrval binary(16) INSERT INTO dbo.tblSQLUpdates( SQLUpdate_By, SQLUpdate_DB, SQLUpdate_Object, SQLUpdate_Description ) VALUES ( @SQLUpdate_By, @SQLUpdate_DB, @SQLUpdate_Object, @SQLUpdate_Description ) SELECT @SQLUpdate_ID = @@Identity SELECT @ptrval = TEXTPTR(SQLUpdate_Script) FROM dbo.tblSQLUpdates WHERE SQLUpdate_ID = @SQLUpdate_ID WRITETEXT tblSQLUpdates.SQLUpdate_ID @ptrval @SQLUpdate_Script When writing the text back, I am getting a truncated value. My guess is that it is around 8000 characters. Anyone have any insight into it? Thanks, Robert _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael at ddisolutions.com.au Thu Jan 18 19:01:05 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Fri, 19 Jan 2007 12:01:05 +1100 Subject: [dba-SQLServer] SQL Server - Make Date Field Display 2 DigitYear Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AEF6@ddi-01.DDI.local> I think 3 is the correct style... convert(YourDate,varchar(15),3) However the question was how to store a 2 digit year which is a bit odd... However AFAIK you cant and keep the datetime datatype. You would need to store it as a string... Sounds a like FE display issue to me not a db issue. cheers Michael M convert(YourDate,varchar(15),1) At 12:00 PM 1/18/2007, you wrote: >Date: Thu, 18 Jan 2007 12:01:54 +0100 (CET) >From: paul.hartland at fsmail.net >Subject: [dba-SQLServer] SQL Server - Make Date Field Display 2 Digit > Year Only >To: accessd , dba-sqlserver > >Message-ID: > ><20389518.198761169118114607.JavaMail.www at wwinf3004.me-wanadoo.net> >Content-Type: text/plain; charset=UTF-8 > >To all, > >I have a date field in a table in SQL Server 2000, which displays the >date as DD/MM/YYYY. Does anyone know how to make the date field just >hold a 2 digit year DD/MM/YY ? > >Thanks in advance for any help on this. > > >Paul Hartland >paul.hartland at fsmail.net >07730 523179 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Fri Jan 19 07:57:21 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Fri, 19 Jan 2007 07:57:21 -0600 Subject: [dba-SQLServer] Text column truncating In-Reply-To: References: Message-ID: <200701191359.l0JDxKR28943@databaseadvisors.com> Michael, We finally figured out that it was the cold fusion front end that was doing it. And, no way of getting around it. Guess that is what happens when you don't use Microsoft technologies. Robert At 06:55 PM 1/18/2007, you wrote: >Date: Fri, 19 Jan 2007 11:47:29 +1100 >From: "Michael Maddison" >Subject: Re: [dba-SQLServer] Text column truncating >To: >Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AEF5 at ddi-01.DDI.local> >Content-Type: text/plain; charset="us-ascii" > >Are you sure its not the viewer app that's truncating? >If your testing in QA you can set the column width in options to show >more then 8000 chars. >Your code looks ok to me. > > >cheers > > >Michael M From artful at rogers.com Sat Jan 20 09:31:27 2007 From: artful at rogers.com (artful at rogers.com) Date: Sat, 20 Jan 2007 07:31:27 -0800 (PST) Subject: [dba-SQLServer] Route Planning Message-ID: <20070120153127.89408.qmail@web88206.mail.re2.yahoo.com> Does anyone know whether such software as MapQuest or MapPoint provides a way to plan a route (such as a Fedex truck delivery route) that would optimize for least distance? From what I can see, MapPoint expects you to plan the route. What I had in mind was piping in 20 addresses and having it do the planning. TIA, Arthur From jlawrenc1 at shaw.ca Sat Jan 20 12:15:28 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Sat, 20 Jan 2007 10:15:28 -0800 Subject: [dba-SQLServer] Route Planning In-Reply-To: <20070120153127.89408.qmail@web88206.mail.re2.yahoo.com> Message-ID: <0JC600DGQIMIJJ00@l-daemon> Hi Arthur: I am not sure of mappoint or mapquest but I do know that GoogleMaps has that feature: For mobile phones with API http://www.google.ca/gmm/index.html?utm_source=ca-et-more&utm_medium=et&utm_ campaign=gmm Google maps API documentation: http://www.google.com/apis/maps/documentation/ HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Saturday, January 20, 2007 7:31 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Route Planning Does anyone know whether such software as MapQuest or MapPoint provides a way to plan a route (such as a Fedex truck delivery route) that would optimize for least distance? From what I can see, MapPoint expects you to plan the route. What I had in mind was piping in 20 addresses and having it do the planning. TIA, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Sat Jan 20 18:47:06 2007 From: artful at rogers.com (artful at rogers.com) Date: Sat, 20 Jan 2007 16:47:06 -0800 (PST) Subject: [dba-SQLServer] Route Planning Message-ID: <20070121004706.75607.qmail@web88201.mail.re2.yahoo.com> Thanks! I will look into that one pronto. ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Saturday, January 20, 2007 1:15:28 PM Subject: Re: [dba-SQLServer] Route Planning Hi Arthur: I am not sure of mappoint or mapquest but I do know that GoogleMaps has that feature: For mobile phones with API http://www.google.ca/gmm/index.html?utm_source=ca-et-more&utm_medium=et&utm_ campaign=gmm Google maps API documentation: http://www.google.com/apis/maps/documentation/ HTH Jim From martyconnelly at shaw.ca Sat Jan 20 19:34:18 2007 From: martyconnelly at shaw.ca (MartyConnelly) Date: Sat, 20 Jan 2007 17:34:18 -0800 Subject: [dba-SQLServer] Route Planning In-Reply-To: <20070120153127.89408.qmail@web88206.mail.re2.yahoo.com> References: <20070120153127.89408.qmail@web88206.mail.re2.yahoo.com> Message-ID: <45B2C31A.3090306@shaw.ca> Most of these programs will plot a route but not compute the optimum route. For this you need the TSP (Traveling Salesman Problem) algorithm The TSP is an NP-complete problem, it could be done on google maps. but I have not seen any JavaScript code to solve this, it would be hairy. I have some quick VBA code that will display a route via Virtual Earth with driving distances I can post, Why is it difficult for optimising?? If you know the distances of the routes, or are happy to work with straight line distances, then obtaining the solution for a small number of points can be achieved by running a simple exhaustive search. The problem with the travelling salesman is that an exhaustive search algorithm needs to examine (n-1)!/2 possible routes. So for 6 markers there's 60 possibilities to be checked, but for 12 markers there's just short of 20 million, and for 18 markers there's nearly 15 trillion possibilities. By the time you get to the classic problem of visiting all the US state capitals the amount of processing involved in an exhaustive search becomes somewhat impractical but has been done and quicker algorithms have replaced the original solution from the late 50's You could try this Concode TSP for Windows program http://www.tsp.gatech.edu/concorde/gui/gui.htm artful at rogers.com wrote: >Does anyone know whether such software as MapQuest or MapPoint provides a way to plan a route (such as a Fedex truck delivery route) that would optimize for least distance? From what I can see, MapPoint expects you to plan the route. What I had in mind was piping in 20 addresses and having it do the planning. > >TIA, >Arthur > > > > -- Marty Connelly Victoria, B.C. Canada From jlawrenc1 at shaw.ca Sat Jan 20 21:08:22 2007 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Sat, 20 Jan 2007 19:08:22 -0800 Subject: [dba-SQLServer] Route Planning In-Reply-To: <45B2C31A.3090306@shaw.ca> Message-ID: <0JC700FHN7AMGHE0@l-daemon> Hi Marty: My Gawd where do you come up with this stuff... Quite impressive but scary. :-) Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Saturday, January 20, 2007 5:34 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Route Planning Most of these programs will plot a route but not compute the optimum route. For this you need the TSP (Traveling Salesman Problem) algorithm The TSP is an NP-complete problem, it could be done on google maps. but I have not seen any JavaScript code to solve this, it would be hairy. I have some quick VBA code that will display a route via Virtual Earth with driving distances I can post, Why is it difficult for optimising?? If you know the distances of the routes, or are happy to work with straight line distances, then obtaining the solution for a small number of points can be achieved by running a simple exhaustive search. The problem with the travelling salesman is that an exhaustive search algorithm needs to examine (n-1)!/2 possible routes. So for 6 markers there's 60 possibilities to be checked, but for 12 markers there's just short of 20 million, and for 18 markers there's nearly 15 trillion possibilities. By the time you get to the classic problem of visiting all the US state capitals the amount of processing involved in an exhaustive search becomes somewhat impractical but has been done and quicker algorithms have replaced the original solution from the late 50's You could try this Concode TSP for Windows program http://www.tsp.gatech.edu/concorde/gui/gui.htm artful at rogers.com wrote: >Does anyone know whether such software as MapQuest or MapPoint provides a way to plan a route (such as a Fedex truck delivery route) that would optimize for least distance? From what I can see, MapPoint expects you to plan the route. What I had in mind was piping in 20 addresses and having it do the planning. > >TIA, >Arthur > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From martyconnelly at shaw.ca Sat Jan 20 22:08:29 2007 From: martyconnelly at shaw.ca (MartyConnelly) Date: Sat, 20 Jan 2007 20:08:29 -0800 Subject: [dba-SQLServer] Route Planning In-Reply-To: <0JC700FHN7AMGHE0@l-daemon> References: <0JC700FHN7AMGHE0@l-daemon> Message-ID: <45B2E73D.40806@shaw.ca> I worked in GIS systems throughout the 70's and had to build or find my own math and stats algorithms, that meant haunting university libraries there was no Internet *sob* , so most of the basic ones, I can still remember the algorithm names. Some have been known for nearly 2 centuries. I even published some code in a Canadian Cartographic journal in the early 70's. Youngsters will laugh at my feeble attempts but they worked in old Fortran II. Not efficient or very fast. A lot were based on simple geometry. But back then they were golly gee whizz. Jim Lawrence wrote: >Hi Marty: > >My Gawd where do you come up with this stuff... Quite impressive but scary. >:-) > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of >MartyConnelly >Sent: Saturday, January 20, 2007 5:34 PM >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Route Planning > >Most of these programs will plot a route but not compute the optimum >route. For this you need the TSP (Traveling Salesman Problem) algorithm >The TSP is an NP-complete problem, it could be done on google maps. >but I have not seen any JavaScript code to solve this, it would be hairy. > >I have some quick VBA code that will display a route via Virtual Earth >with driving distances I can post, > > >Why is it difficult for optimising?? > >If you know the distances of the routes, or are happy to work with >straight line distances, then obtaining the solution for a small >number of points can be achieved by running a simple exhaustive search. >The problem with the travelling salesman is that an exhaustive search >algorithm needs to examine (n-1)!/2 possible routes. So for 6 markers >there's 60 possibilities to be checked, but for 12 markers there's just >short of 20 million, and for 18 markers there's nearly 15 trillion >possibilities. By the time you get to the classic problem of visiting >all the US state capitals the amount of processing involved in an >exhaustive search becomes somewhat impractical but has been >done and quicker algorithms have replaced the original solution >from the late 50's > >You could try this > >Concode TSP for Windows program >http://www.tsp.gatech.edu/concorde/gui/gui.htm > > >artful at rogers.com wrote: > > > >>Does anyone know whether such software as MapQuest or MapPoint provides a >> >> >way to plan a route (such as a Fedex truck delivery route) that would >optimize for least distance? From what I can see, MapPoint expects you to >plan the route. What I had in mind was piping in 20 addresses and having it >do the planning. > > >>TIA, >>Arthur >> >> >> >> >> >> > > > -- Marty Connelly Victoria, B.C. Canada From artful at rogers.com Sat Jan 20 23:32:26 2007 From: artful at rogers.com (artful at rogers.com) Date: Sat, 20 Jan 2007 21:32:26 -0800 (PST) Subject: [dba-SQLServer] Route Planning Message-ID: <20070121053226.15570.qmail@web88209.mail.re2.yahoo.com> I am well acquainted with the TSP problem, and have written some Genetic Algorithms to solve it, but they all depend on a pre-existing databases of distances between cities, and thus are not appropriate. I thought that maybe MapQuest or MapPoint had these distances built-in. Actually, they both do. They simply (or complexly) have not applied the TSP algorithms to them. Maybe that's an extension that could be for sale. I was hoping that it already was, but if not, then since I am well acquainted with the problem, maybe that's my next project. A. ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Saturday, January 20, 2007 10:08:22 PM Subject: Re: [dba-SQLServer] Route Planning Hi Marty: My Gawd where do you come up with this stuff... Quite impressive but scary. :-) Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of MartyConnelly Sent: Saturday, January 20, 2007 5:34 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Route Planning Most of these programs will plot a route but not compute the optimum route. For this you need the TSP (Traveling Salesman Problem) algorithm The TSP is an NP-complete problem, it could be done on google maps. but I have not seen any JavaScript code to solve this, it would be hairy. I have some quick VBA code that will display a route via Virtual Earth with driving distances I can post, Why is it difficult for optimising?? If you know the distances of the routes, or are happy to work with straight line distances, then obtaining the solution for a small number of points can be achieved by running a simple exhaustive search. The problem with the travelling salesman is that an exhaustive search algorithm needs to examine (n-1)!/2 possible routes. So for 6 markers there's 60 possibilities to be checked, but for 12 markers there's just short of 20 million, and for 18 markers there's nearly 15 trillion possibilities. By the time you get to the classic problem of visiting all the US state capitals the amount of processing involved in an exhaustive search becomes somewhat impractical but has been done and quicker algorithms have replaced the original solution from the late 50's You could try this Concode TSP for Windows program http://www.tsp.gatech.edu/concorde/gui/gui.htm artful at rogers.com wrote: >Does anyone know whether such software as MapQuest or MapPoint provides a way to plan a route (such as a Fedex truck delivery route) that would optimize for least distance? From what I can see, MapPoint expects you to plan the route. What I had in mind was piping in 20 addresses and having it do the planning. > >TIA, >Arthur > > > > -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jan 21 14:43:10 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 21 Jan 2007 15:43:10 -0500 Subject: [dba-SQLServer] SQL Server indexes Message-ID: <001a01c73d9c$c3fa1ed0$657aa8c0@m6805> Am I correct that in a given column, 'Y' and NULL is the "same as" 'Y' and 'N' or 'Y' and '' (empty string) as far as usefulness of an index goes? IOW all three of these examples are "two choices" and thus would likely not benefit from an Index for selection speed? John W. Colby Colby Consulting www.ColbyConsulting.com From stuart at lexacorp.com.pg Sun Jan 21 16:10:57 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Mon, 22 Jan 2007 08:10:57 +1000 Subject: [dba-SQLServer] SQL Server indexes In-Reply-To: <001a01c73d9c$c3fa1ed0$657aa8c0@m6805> References: <001a01c73d9c$c3fa1ed0$657aa8c0@m6805> Message-ID: <45B3E4F1.13296.74E9226@stuart.lexacorp.com.pg> Yep, as we discussed just on a month ago. If in general a query returns more than about 10 percent of the records, a table scan is more efficient than an index. On 21 Jan 2007 at 15:43, JWColby wrote: > Am I correct that in a given column, 'Y' and NULL is the "same as" 'Y' and > 'N' or 'Y' and '' (empty string) as far as usefulness of an index goes? IOW > all three of these examples are "two choices" and thus would likely not > benefit from an Index for selection speed? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > -- Stuart From jwcolby at colbyconsulting.com Sun Jan 21 17:36:40 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 21 Jan 2007 18:36:40 -0500 Subject: [dba-SQLServer] SQL Server indexes In-Reply-To: <45B3E4F1.13296.74E9226@stuart.lexacorp.com.pg> Message-ID: <002a01c73db5$00ddf6b0$657aa8c0@m6805> Thanks Stuart. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Sunday, January 21, 2007 5:11 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server indexes Yep, as we discussed just on a month ago. If in general a query returns more than about 10 percent of the records, a table scan is more efficient than an index. On 21 Jan 2007 at 15:43, JWColby wrote: > Am I correct that in a given column, 'Y' and NULL is the "same as" 'Y' > and 'N' or 'Y' and '' (empty string) as far as usefulness of an index > goes? IOW all three of these examples are "two choices" and thus > would likely not benefit from an Index for selection speed? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > -- Stuart _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jan 21 17:48:33 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 21 Jan 2007 18:48:33 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases Message-ID: <002e01c73db6$a97e7e10$657aa8c0@m6805> I was doing a log of work in my database this weekend and the file size grew to a couple of hundred gig. I then "shrank" the individual files. This happened VERY rapidly, as in a few seconds. The log file had well over 80 gb of empty space and shrank down to just a few megabytes. I then went back in to my main database and deleted a ton of "temporary" individual tables that I had been working with. I decided that since it was so quick to shrink again. Unfortunately this time I made the mistake of "shrinking" the database instead of the database files. SIX HOURS LATER it is still not done. So the first question is, what the heck is it doing that takes six hours where the individual files only took a few seconds? Second, is there any way to break out and tell it to give me back control? I don't appear to be able to do anything while it is "shrinking" and I have work to do. Third, is it possible to determine how long this is going to take, break it into pieces or anything similar. It seems unreasonable to me to completely disable the database for hours on end in order to shrink a database. Fourth, is it even necessary? IOW, is it like Access where unused space is never reused? Does it fill back up the now empty space if you don't shrink it? Does it get fragmented in some way that makes shrinking useful if not absolutely necessary? John W. Colby Colby Consulting www.ColbyConsulting.com From stuart at lexacorp.com.pg Sun Jan 21 18:25:57 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Mon, 22 Jan 2007 10:25:57 +1000 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <002e01c73db6$a97e7e10$657aa8c0@m6805> References: <002e01c73db6$a97e7e10$657aa8c0@m6805> Message-ID: <45B49135.16945.23CA5698@stuart.lexacorp.com.pg> 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft? SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file size grew > to a couple of hundred gig. I then "shrank" the individual files. This > happened VERY rapidly, as in a few seconds. The log file had well over 80 > gb of empty space and shrank down to just a few megabytes. I then went back > in to my main database and deleted a ton of "temporary" individual tables > that I had been working with. I decided that since it was so quick to > shrink again. Unfortunately this time I made the mistake of "shrinking" the > database instead of the database files. SIX HOURS LATER it is still not > done. > > So the first question is, what the heck is it doing that takes six hours > where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I have > work to do. > > Third, is it possible to determine how long this is going to take, break it > into pieces or anything similar. It seems unreasonable to me to completely > disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused space is > never reused? Does it fill back up the now empty space if you don't shrink > it? Does it get fragmented in some way that makes shrinking useful if not > absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From michael at ddisolutions.com.au Sun Jan 21 20:21:47 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Mon, 22 Jan 2007 13:21:47 +1100 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AF0A@ddi-01.DDI.local> Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jan 21 21:18:41 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sun, 21 Jan 2007 22:18:41 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0116AF0A@ddi-01.DDI.local> Message-ID: <003c01c73dd4$048c8eb0$657aa8c0@m6805> LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael at ddisolutions.com.au Sun Jan 21 21:31:14 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Mon, 22 Jan 2007 14:31:14 +1100 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AF0B@ddi-01.DDI.local> NP, I've found the whole shrink thing rather strange at times too. What you need to keep in mind is that IIRC shrink only reclaims the log to the last backup point backwards... So in effect you cannot reclaim the log that has not been backed up... of course I could be wrong with the details... lol cheers Michael M -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, 22 January 2007 2:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 05:41:06 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 06:41:06 -0500 Subject: [dba-SQLServer] Migrating tables to a new database Message-ID: <001d01c73e1a$34d82200$657aa8c0@m6805> Is it possible to migrate a table, complete with all indexes and any other attributes to another database? Whenever I do an Import Data it just kind of does a generic "here's your data" kind of thing. The business I am getting into involves taking lists of addresses along which includes what I call survey data. There is a TON of preprocessing involved getting the addresses run through a set of processes to check with the US Postal Service to ensure that the address is deliverable - CASS (does the address conform to the USPS system), DPV (Delivery Point Validation - the address exists), and NCOA which means essentially "have they changed addresses". Given all of the preprocessing, I really want to do this out in a separate database for each list, where when I am finished a completely processed set of records exists. Having done all of that, I need to merge the data into a master database of people, valid addresses, and people at addresses. For technical reasons I need to be able to track where people have lived. I have processed a huge list and now have a database with information about the people in THIS LIST. I am considering building up my People / Address / PeopleAtAddress tables inside of this first list database, and then later migrating these three tables out to a separate database. I do not wish to do that however if I am going to lose all of the indexes I set up etc. Any pointers on this matter? John W. Colby Colby Consulting www.ColbyConsulting.com From accessd at shaw.ca Mon Jan 22 06:03:47 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 04:03:47 -0800 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <003c01c73dd4$048c8eb0$657aa8c0@m6805> Message-ID: <0JC900NOMQR102Q0@l-daemon> Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 06:22:30 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 07:22:30 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <0JC900NOMQR102Q0@l-daemon> Message-ID: <002a01c73e1f$fcebab40$657aa8c0@m6805> Interesting. Is there a way to turn that off? I didn't specifically tell it to, OTOH I didn't tell it not to either. I just assumed that it was going to copy everything real into a new db file, leaving out the now empty space. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 7:04 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From ridermark at gmail.com Mon Jan 22 06:30:50 2007 From: ridermark at gmail.com (Mark Rider) Date: Mon, 22 Jan 2007 06:30:50 -0600 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <001d01c73e1a$34d82200$657aa8c0@m6805> References: <001d01c73e1a$34d82200$657aa8c0@m6805> Message-ID: The way I have always handled the migration is to create a table in the new DB with all of the indices and constratints and then used DTS to import from the old database. I am hoping someone will have a more elegant solution, but this has always worked for me. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Mon Jan 22 07:05:52 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 08:05:52 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: Message-ID: <002c01c73e26$0c2d8e60$657aa8c0@m6805> Yea, that was what I was afraid of. I really need to learn the syntax and method of dropping indexes and rebuilding indexes so that I can build scripts to do this. Then perhaps the text of the scripts would be portable. I am really just learning how to work with SQL Server. It is kind of clunky in some ways. For example you can select and copy field definitions from one table to another, even across databases, but you cannot do the same for the view fields. I am going to have to learn where the breakeven point is to dropping indexes before "bulk" adding data to tables. In the future I will have some tables like people and addresses where there are tens or even hundreds of millions of records. I will then be adding thousands or millions of new records at a time. Each of these tables often have indexes on pretty much every field (3 to 7 indexes). If I want the database to remain usable while I add the new records, i.e. respond to queries in a timely manner using the indexes, then it seems that leaving the indexes in place while I add the new data would be required. I will have to discover how long it takes to add back half a dozen indexes on a hundred million records. Perhaps all of this will have to be relegated to the middle of the night. So much to know, so little time. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Monday, January 22, 2007 7:31 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database The way I have always handled the migration is to create a table in the new DB with all of the indices and constratints and then used DTS to import from the old database. I am hoping someone will have a more elegant solution, but this has always worked for me. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From James at fcidms.com Mon Jan 22 09:33:56 2007 From: James at fcidms.com (James Barash) Date: Mon, 22 Jan 2007 10:33:56 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <001d01c73e1a$34d82200$657aa8c0@m6805> Message-ID: <00a501c73e3a$bb4205c0$800101df@fci.local> John: If you are using Enterprise Manager, you can use the Import Data Wizard and instead of using Copy Tables, use Copy Objects and Data. Then uncheck copy all objects and select the table you need to copy and it will create the table with all its indexes, relationships, etc. if there are any and then copy the data. I use this all the time and found it works very well. Hope this helps. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 6:41 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Migrating tables to a new database Is it possible to migrate a table, complete with all indexes and any other attributes to another database? Whenever I do an Import Data it just kind of does a generic "here's your data" kind of thing. The business I am getting into involves taking lists of addresses along which includes what I call survey data. There is a TON of preprocessing involved getting the addresses run through a set of processes to check with the US Postal Service to ensure that the address is deliverable - CASS (does the address conform to the USPS system), DPV (Delivery Point Validation - the address exists), and NCOA which means essentially "have they changed addresses". Given all of the preprocessing, I really want to do this out in a separate database for each list, where when I am finished a completely processed set of records exists. Having done all of that, I need to merge the data into a master database of people, valid addresses, and people at addresses. For technical reasons I need to be able to track where people have lived. I have processed a huge list and now have a database with information about the people in THIS LIST. I am considering building up my People / Address / PeopleAtAddress tables inside of this first list database, and then later migrating these three tables out to a separate database. I do not wish to do that however if I am going to lose all of the indexes I set up etc. Any pointers on this matter? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 09:57:45 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 10:57:45 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <00a501c73e3a$bb4205c0$800101df@fci.local> Message-ID: <004901c73e3e$0f2fbdf0$657aa8c0@m6805> COOL! Thanks James. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of James Barash Sent: Monday, January 22, 2007 10:34 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database John: If you are using Enterprise Manager, you can use the Import Data Wizard and instead of using Copy Tables, use Copy Objects and Data. Then uncheck copy all objects and select the table you need to copy and it will create the table with all its indexes, relationships, etc. if there are any and then copy the data. I use this all the time and found it works very well. Hope this helps. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 6:41 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Migrating tables to a new database Is it possible to migrate a table, complete with all indexes and any other attributes to another database? Whenever I do an Import Data it just kind of does a generic "here's your data" kind of thing. The business I am getting into involves taking lists of addresses along which includes what I call survey data. There is a TON of preprocessing involved getting the addresses run through a set of processes to check with the US Postal Service to ensure that the address is deliverable - CASS (does the address conform to the USPS system), DPV (Delivery Point Validation - the address exists), and NCOA which means essentially "have they changed addresses". Given all of the preprocessing, I really want to do this out in a separate database for each list, where when I am finished a completely processed set of records exists. Having done all of that, I need to merge the data into a master database of people, valid addresses, and people at addresses. For technical reasons I need to be able to track where people have lived. I have processed a huge list and now have a database with information about the people in THIS LIST. I am considering building up my People / Address / PeopleAtAddress tables inside of this first list database, and then later migrating these three tables out to a separate database. I do not wish to do that however if I am going to lose all of the indexes I set up etc. Any pointers on this matter? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From ridermark at gmail.com Mon Jan 22 10:13:41 2007 From: ridermark at gmail.com (Mark Rider) Date: Mon, 22 Jan 2007 10:13:41 -0600 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <00a501c73e3a$bb4205c0$800101df@fci.local> References: <001d01c73e1a$34d82200$657aa8c0@m6805> <00a501c73e3a$bb4205c0$800101df@fci.local> Message-ID: Great tip, James. But just to add a twist, is this something that can be done in SQL 2005? I am just starting to get into that, coming from SQL 2000, and am curious if there is another way (as there seems to ALWAYS be) in 2005. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Mon Jan 22 10:17:39 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 11:17:39 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <002c01c73e26$0c2d8e60$657aa8c0@m6805> Message-ID: <004a01c73e40$d69f9480$657aa8c0@m6805> Just an FYI. It took two hours two minutes to copy 53 million records consisting of the just the PK, Fname, Mname and Lname from one table in one database to a table in another database - with indexes on only an integer FK, a currently empty MatchCode field and an autoincrement PK being created as well. I do not have any experience to tell me whether this is fast, slow or indifferent The system is a dual core AMD X64 2.8 ghz processor with 3 gb ram and a 1 tbyte raid 6 volume, running on Windows2003. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 8:06 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database Yea, that was what I was afraid of. I really need to learn the syntax and method of dropping indexes and rebuilding indexes so that I can build scripts to do this. Then perhaps the text of the scripts would be portable. I am really just learning how to work with SQL Server. It is kind of clunky in some ways. For example you can select and copy field definitions from one table to another, even across databases, but you cannot do the same for the view fields. I am going to have to learn where the breakeven point is to dropping indexes before "bulk" adding data to tables. In the future I will have some tables like people and addresses where there are tens or even hundreds of millions of records. I will then be adding thousands or millions of new records at a time. Each of these tables often have indexes on pretty much every field (3 to 7 indexes). If I want the database to remain usable while I add the new records, i.e. respond to queries in a timely manner using the indexes, then it seems that leaving the indexes in place while I add the new data would be required. I will have to discover how long it takes to add back half a dozen indexes on a hundred million records. Perhaps all of this will have to be relegated to the middle of the night. So much to know, so little time. John W. Colby Colby Consulting www.ColbyConsulting.com From accessd at shaw.ca Mon Jan 22 13:06:37 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 11:06:37 -0800 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <002a01c73e1f$fcebab40$657aa8c0@m6805> Message-ID: <0JCA00B8BABQC1N0@l-daemon> Hi John: I was talking with a fellow from Calgary a while back and their company removes all the indexes when manipulating large tables that will change the indexes. If there is to be a lot of modifications one script is designed to remove the indexes and another one is created to add them back. Sometimes the most processing time on a project is waiting for the indexes to rebuild. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 4:23 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Interesting. Is there a way to turn that off? I didn't specifically tell it to, OTOH I didn't tell it not to either. I just assumed that it was going to copy everything real into a new db file, leaving out the now empty space. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 7:04 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Mon Jan 22 13:08:16 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 11:08:16 -0800 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: Message-ID: <0JCA0050JAEIG841@l-daemon> Mark: I use a similar method... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Monday, January 22, 2007 4:31 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database The way I have always handled the migration is to create a table in the new DB with all of the indices and constratints and then used DTS to import from the old database. I am hoping someone will have a more elegant solution, but this has always worked for me. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Mon Jan 22 13:09:14 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 11:09:14 -0800 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <00a501c73e3a$bb4205c0$800101df@fci.local> Message-ID: <0JCA00BGWAG6BZJ0@l-daemon> Brilliant James... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of James Barash Sent: Monday, January 22, 2007 7:34 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database John: If you are using Enterprise Manager, you can use the Import Data Wizard and instead of using Copy Tables, use Copy Objects and Data. Then uncheck copy all objects and select the table you need to copy and it will create the table with all its indexes, relationships, etc. if there are any and then copy the data. I use this all the time and found it works very well. Hope this helps. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 6:41 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Migrating tables to a new database Is it possible to migrate a table, complete with all indexes and any other attributes to another database? Whenever I do an Import Data it just kind of does a generic "here's your data" kind of thing. The business I am getting into involves taking lists of addresses along which includes what I call survey data. There is a TON of preprocessing involved getting the addresses run through a set of processes to check with the US Postal Service to ensure that the address is deliverable - CASS (does the address conform to the USPS system), DPV (Delivery Point Validation - the address exists), and NCOA which means essentially "have they changed addresses". Given all of the preprocessing, I really want to do this out in a separate database for each list, where when I am finished a completely processed set of records exists. Having done all of that, I need to merge the data into a master database of people, valid addresses, and people at addresses. For technical reasons I need to be able to track where people have lived. I have processed a huge list and now have a database with information about the people in THIS LIST. I am considering building up my People / Address / PeopleAtAddress tables inside of this first list database, and then later migrating these three tables out to a separate database. I do not wish to do that however if I am going to lose all of the indexes I set up etc. Any pointers on this matter? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Mon Jan 22 13:19:44 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Mon, 22 Jan 2007 13:19:44 -0600 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: References: Message-ID: <200701221924.l0MJOKR26877@databaseadvisors.com> Depending on how you did it, that is not bad. I think that using SSIS would have given you better performance. and, it is the replacement for DTS. At 12:00 PM 1/22/2007, you wrote: >Date: Mon, 22 Jan 2007 11:17:39 -0500 >From: "JWColby" >Subject: Re: [dba-SQLServer] Migrating tables to a new database >To: >Message-ID: <004a01c73e40$d69f9480$657aa8c0 at m6805> >Content-Type: text/plain; charset="us-ascii" > >Just an FYI. It took two hours two minutes to copy 53 million records >consisting of the just the PK, Fname, Mname and Lname from one table in one >database to a table in another database - with indexes on only an integer >FK, a currently empty MatchCode field and an autoincrement PK being created >as well. > >I do not have any experience to tell me whether this is fast, slow or >indifferent > >The system is a dual core AMD X64 2.8 ghz processor with 3 gb ram and a 1 >tbyte raid 6 volume, running on Windows2003. > > >John W. Colby >Colby Consulting >www.ColbyConsulting.com From shait at mindspring.com Mon Jan 22 13:33:47 2007 From: shait at mindspring.com (Stephen Hait) Date: Mon, 22 Jan 2007 14:33:47 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <0JCA00B8BABQC1N0@l-daemon> References: <002a01c73e1f$fcebab40$657aa8c0@m6805> <0JCA00B8BABQC1N0@l-daemon> Message-ID: On 1/22/07, Jim Lawrence wrote: > Hi John: > > I was talking with a fellow from Calgary a while back and their company > removes all the indexes when manipulating large tables that will change the > indexes. If there is to be a lot of modifications one script is designed to > remove the indexes and another one is created to add them back. Sometimes > the most processing time on a project is waiting for the indexes to rebuild. > > Jim That's been my experience, too. Whenever I've had to load tables with large amounts of data, I've usually used BCP and scripted the operation (a simple batch file with isql and bcp commands works well) to drop any indexes prior to inserting and then rebuild them afterwards. Stephen From jwcolby at colbyconsulting.com Mon Jan 22 13:34:58 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 14:34:58 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <200701221924.l0MJOKR26877@databaseadvisors.com> Message-ID: <00bc01c73e5c$673c8000$657aa8c0@m6805> I just ran an update query. I built an insert query of one table, an insert query of the other, cut and pasted to make one, then ran it. Both tables are on one physical machine, but different physical databases (different database files). John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Monday, January 22, 2007 2:20 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database Depending on how you did it, that is not bad. I think that using SSIS would have given you better performance. and, it is the replacement for DTS. At 12:00 PM 1/22/2007, you wrote: >Date: Mon, 22 Jan 2007 11:17:39 -0500 >From: "JWColby" >Subject: Re: [dba-SQLServer] Migrating tables to a new database >To: >Message-ID: <004a01c73e40$d69f9480$657aa8c0 at m6805> >Content-Type: text/plain; charset="us-ascii" > >Just an FYI. It took two hours two minutes to copy 53 million records >consisting of the just the PK, Fname, Mname and Lname from one table in >one database to a table in another database - with indexes on only an >integer FK, a currently empty MatchCode field and an autoincrement PK >being created as well. > >I do not have any experience to tell me whether this is fast, slow or >indifferent > >The system is a dual core AMD X64 2.8 ghz processor with 3 gb ram and a >1 tbyte raid 6 volume, running on Windows2003. > > >John W. Colby >Colby Consulting >www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 13:43:07 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 14:43:07 -0500 Subject: [dba-SQLServer] Migrating tables to a new database In-Reply-To: <00bc01c73e5c$673c8000$657aa8c0@m6805> Message-ID: <00d201c73e5d$8adc6a10$657aa8c0@m6805> Oops, should have read "a select query... An insert query...". Basically it was just SQL running an insert pulling data from one database / table and inserting it into another database/table. All on one physical machine however. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 2:35 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database I just ran an update query. I built an insert query of one table, an insert query of the other, cut and pasted to make one, then ran it. Both tables are on one physical machine, but different physical databases (different database files). John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Monday, January 22, 2007 2:20 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Migrating tables to a new database Depending on how you did it, that is not bad. I think that using SSIS would have given you better performance. and, it is the replacement for DTS. At 12:00 PM 1/22/2007, you wrote: >Date: Mon, 22 Jan 2007 11:17:39 -0500 >From: "JWColby" >Subject: Re: [dba-SQLServer] Migrating tables to a new database >To: >Message-ID: <004a01c73e40$d69f9480$657aa8c0 at m6805> >Content-Type: text/plain; charset="us-ascii" > >Just an FYI. It took two hours two minutes to copy 53 million records >consisting of the just the PK, Fname, Mname and Lname from one table in >one database to a table in another database - with indexes on only an >integer FK, a currently empty MatchCode field and an autoincrement PK >being created as well. > >I do not have any experience to tell me whether this is fast, slow or >indifferent > >The system is a dual core AMD X64 2.8 ghz processor with 3 gb ram and a >1 tbyte raid 6 volume, running on Windows2003. > > >John W. Colby >Colby Consulting >www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 13:44:57 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 14:44:57 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <0JCA00B8BABQC1N0@l-daemon> Message-ID: <00d301c73e5d$cc78fbf0$657aa8c0@m6805> Is there any way to get sql server to build the script from existing indexes? Again, I am a real nube here. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 2:07 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: I was talking with a fellow from Calgary a while back and their company removes all the indexes when manipulating large tables that will change the indexes. If there is to be a lot of modifications one script is designed to remove the indexes and another one is created to add them back. Sometimes the most processing time on a project is waiting for the indexes to rebuild. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 4:23 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Interesting. Is there a way to turn that off? I didn't specifically tell it to, OTOH I didn't tell it not to either. I just assumed that it was going to copy everything real into a new db file, leaving out the now empty space. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 7:04 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From chizotz at mchsi.com Mon Jan 22 13:56:28 2007 From: chizotz at mchsi.com (Ron Allen) Date: Mon, 22 Jan 2007 19:56:28 +0000 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases Message-ID: <012220071956.10158.45B516EC000730F3000027AE219792474103010CD2079C080C03BF969B019607080C@mchsi.com> John, In SQL Server 2K you can right-click a table in EM and select All Tasks - Generate SQL Script. There are options to script indexes etc. There may be better or other ways to do it, but that's someplace to look. Ron > Is there any way to get sql server to build the script from existing > indexes? From shait at mindspring.com Mon Jan 22 14:04:42 2007 From: shait at mindspring.com (Stephen Hait) Date: Mon, 22 Jan 2007 15:04:42 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <00d301c73e5d$cc78fbf0$657aa8c0@m6805> References: <0JCA00B8BABQC1N0@l-daemon> <00d301c73e5d$cc78fbf0$657aa8c0@m6805> Message-ID: On 1/22/07, JWColby wrote: > Is there any way to get sql server to build the script from existing > indexes? EM for SQL Server 2000 can generate the SQL to create the indexes. Right click the table you want to script indexes for, select All Tasks, Generate SQL Script and look at the options there. Stephen From jwcolby at colbyconsulting.com Mon Jan 22 15:50:37 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 16:50:37 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Executing query. Waiting for response from data source. Message-ID: <00e401c73e6f$5ad4b590$657aa8c0@m6805> I have related tables in SQL Server. Whenever I try to build a view where I link (drag and drop, inner join) the related FKs between the two tables, I get: "Executing query. Waiting for response from Data Source." It eventually times out, rather quickly in fact, perhaps 30 seconds or so. Management studio returns an error message like: SQL Execution Error Executed SQL Statement: SELECT dbo.tblPeople.PE_ID, ,,, Error Source: .Net SQL Data Provider Error Message: Timeout Expired. The timeout period elapsed prior to completion of the operation, or the server is not responding. The query it attempting to join two tables, each containing 53 million records, on a common foreign key, which should result to a one to one result pulling the PK from the respective table. The idea is to then write those table PKs out to a m-m table to cause these two tables to be related via the m-m table. The used in the join FKs are indexed. It seems that I am truly running into a timeout but I am not sure where. When I select the database and select options, query execution is set for 0 (no timeout). Any clue why (or if) I am timing out? John W. Colby Colby Consulting www.ColbyConsulting.com From artful at rogers.com Mon Jan 22 16:03:27 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 22 Jan 2007 14:03:27 -0800 (PST) Subject: [dba-SQLServer] SQL Server 2005 - Executing query. Waiting for response from data source. Message-ID: <20070122220327.73633.qmail@web88201.mail.re2.yahoo.com> Try this instead. Open SSMS then the databases then the db of interest. Select the Database Diagrams node and plonk on the two tables of interest. Save the diagram. Now go New Query, make sure the right database is selected, and then New Query. Select both tables from the list of tables. SQL should automatically know how to join them. hth, Arthur ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 4:50:37 PM Subject: [dba-SQLServer] SQL Server 2005 - Executing query. Waiting for response from data source. I have related tables in SQL Server. Whenever I try to build a view where I link (drag and drop, inner join) the related FKs between the two tables, I get: "Executing query. Waiting for response from Data Source." It eventually times out, rather quickly in fact, perhaps 30 seconds or so. Management studio returns an error message like: SQL Execution Error Executed SQL Statement: SELECT dbo.tblPeople.PE_ID, ,,, Error Source: .Net SQL Data Provider Error Message: Timeout Expired. The timeout period elapsed prior to completion of the operation, or the server is not responding. The query it attempting to join two tables, each containing 53 million records, on a common foreign key, which should result to a one to one result pulling the PK from the respective table. The idea is to then write those table PKs out to a m-m table to cause these two tables to be related via the m-m table. The used in the join FKs are indexed. It seems that I am truly running into a timeout but I am not sure where. When I select the database and select options, query execution is set for 0 (no timeout). Any clue why (or if) I am timing out? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Mon Jan 22 16:27:51 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 22 Jan 2007 14:27:51 -0800 (PST) Subject: [dba-SQLServer] Question about American medical systems Message-ID: <20070122222751.74236.qmail@web88209.mail.re2.yahoo.com> Presumably somebody here has experience in developing software for American medical applications. I don't need to know everything about it; I just have one precise question at this moment, although I reserve the right to ask more. In Canada there is a notion called a Consent. I will depict it with an illustration: For x years, my family physician was Joe. Then I moved and got a new physician called Jill. Jill does not have the right to view my medical history without my signing a Consent. Now, further assume that I am female, and that I am pregnant, and that I now acquire the services of an obstetrician in addition to my family physician. (The point here is that multiple Consents can co-exist.) Is this at all similar to the situation in the USA? And while I'm at it, comments are also invited from developers in other nations. TIA, Arthur From artful at rogers.com Mon Jan 22 19:11:26 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 22 Jan 2007 17:11:26 -0800 (PST) Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases Message-ID: <20070123011126.41016.qmail@web88209.mail.re2.yahoo.com> My experience is contrary, Jim. IME, drop the indexes, do a bcp and then rebuild the indexes. That will almost always be quicker. A. ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 2:06:37 PM Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: I was talking with a fellow from Calgary a while back and their company removes all the indexes when manipulating large tables that will change the indexes. If there is to be a lot of modifications one script is designed to remove the indexes and another one is created to add them back. Sometimes the most processing time on a project is waiting for the indexes to rebuild. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 4:23 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Interesting. Is there a way to turn that off? I didn't specifically tell it to, OTOH I didn't tell it not to either. I just assumed that it was going to copy everything real into a new db file, leaving out the now empty space. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 7:04 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Mon Jan 22 19:25:58 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 17:25:58 -0800 Subject: [dba-SQLServer] SQL Server 2005 - Shrinking databases In-Reply-To: <20070123011126.41016.qmail@web88209.mail.re2.yahoo.com> Message-ID: <0JCA00IRYRVZO1H2@l-daemon> Hi Arthur: Thanks for the comment but I do not think John is talking about importing data as much as he is about modifying the existing data within the tables. If I am wrong I stand corrected. Regards Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 22, 2007 5:11 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases My experience is contrary, Jim. IME, drop the indexes, do a bcp and then rebuild the indexes. That will almost always be quicker. A. ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 2:06:37 PM Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: I was talking with a fellow from Calgary a while back and their company removes all the indexes when manipulating large tables that will change the indexes. If there is to be a lot of modifications one script is designed to remove the indexes and another one is created to add them back. Sometimes the most processing time on a project is waiting for the indexes to rebuild. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 4:23 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Interesting. Is there a way to turn that off? I didn't specifically tell it to, OTOH I didn't tell it not to either. I just assumed that it was going to copy everything real into a new db file, leaving out the now empty space. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Monday, January 22, 2007 7:04 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John: A lot of the speed problem is related to the rebuilding of the keys and indexes. Logs file do not have any. It sounds like it is rebuilding the index as it goes. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Sunday, January 21, 2007 7:19 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases LOL, running out of space is not my problem. Remember that I have a terabyte raid6 array here. The DB in question takes up about 200 gb and there is well over 600 gb free. At any rate, I am not sure this is a real problem. I just closed the management studio and the whole compact shut down. Strange in itself. I then went in and "shrank" just the database file. Again it finished in just a few seconds but did not physically shrink the file itself. I assume it just reclaimed the internal space. If it can efficiently reuse the space I will leave well enough alone. Oddly, when I shrank just the LOG file it DID shrink the file itself. Ahhh, the mysterious of SQL Server. I had it on Bulk Logged, but have set it to simple as you suggest. At any rate I am back in business now. Thanks for all the suggestions. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Sunday, January 21, 2007 9:22 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Shrinking databases Hi John, While I agree with Stuart... A couple of things to consider... Set the logging option to Simple. This should minimise the log growth. Don't bother reclaiming database space unless you really really need to. It will just grow again and growing takes time and will slow you down, this is especially pertinent to OLTP databases (not yours). I've had shrink operations take a long time when it starts to run out of physical space. It actually uses a LOT of space to do a shrink on the DB... IIRC Just let it run or fail... cheers Michael M 1. No idea 2. You should be able to still work with it. BOL - : DBCC SHRINKDATABASE ...... The database being shrunk does not have to be in single user mode; other users can be working in the database when it is shrunk This includes system databases. 3. You can break it into pieces by using DBCC SHRINKFILE 4. It's certainly not necessary if you set the Autoshrink option in the database properties. Otherwise, according to MS Microsoft(r) SQL ServerTM 2000 is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users On 21 Jan 2007 at 18:48, JWColby wrote: > I was doing a log of work in my database this weekend and the file > size grew to a couple of hundred gig. I then "shrank" the individual > files. This happened VERY rapidly, as in a few seconds. The log file > had well over 80 gb of empty space and shrank down to just a few > megabytes. I then went back in to my main database and deleted a ton > of "temporary" individual tables that I had been working with. I > decided that since it was so quick to shrink again. Unfortunately > this time I made the mistake of "shrinking" the database instead of > the database files. SIX HOURS LATER it is still not done. > > So the first question is, what the heck is it doing that takes six > hours where the individual files only took a few seconds? > > Second, is there any way to break out and tell it to give me back control? > I don't appear to be able to do anything while it is "shrinking" and I > have work to do. > > Third, is it possible to determine how long this is going to take, > break it into pieces or anything similar. It seems unreasonable to me > to completely disable the database for hours on end in order to shrink a database. > > Fourth, is it even necessary? IOW, is it like Access where unused > space is never reused? Does it fill back up the now empty space if > you don't shrink it? Does it get fragmented in some way that makes > shrinking useful if not absolutely necessary? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 19:35:53 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 20:35:53 -0500 Subject: [dba-SQLServer] varchar vs char Message-ID: <000c01c73e8e$d3a7b4d0$657aa8c0@m6805> Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com From artful at rogers.com Mon Jan 22 20:03:00 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 22 Jan 2007 18:03:00 -0800 (PST) Subject: [dba-SQLServer] varchar vs char Message-ID: <20070123020300.14578.qmail@web88211.mail.re2.yahoo.com> AFAIK it has more to do with indexes than with storage. Assuming some column such as Zip 5+4 (i.e. total 9 chars, ignoring the dash) then there is IMO no point in declaring this varchar. Better to declare it either: a) zip 5 (not null) + zip 4 (null); or b) zip 9. The former lets you create a covering index consisting of z5 + z4. The latter gives maximal performance for one precise code, and also for the z5 codes, which should be aligned on one or more pages. These may sound similar but they are different. It depends on how you want to retrieve the data. One might imagine a query such as "select all the clients living in a zip code whose proportion of BMW-ownership is in the TOP 5 zip codes". This could occur because my client is in the business of reselling parts to BMW owners. I might be interested in zip5+4 precisely, or alternatively I might be interested in zip5 and want the zip4 part sorted. Impossible to predict this beforehand. Interrogate the client, discover the data that yields the maximum customer service (e.g. money to be made), and deliver accordingly. In the absence of expert input from the crucial stakeholders, you're guessing about a business you don't comprehend. That's my $.02 anyway. In such meetings, despite all my instincts, I try to shut up and listen. Hear what matters. Sift the stakeholders from the wannabes. Find out what causes the organization to live or die. Focus on that. All else is trivial. A. ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 8:35:53 PM Subject: [dba-SQLServer] varchar vs char Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Mon Jan 22 20:43:01 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 18:43:01 -0800 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <000c01c73e8e$d3a7b4d0$657aa8c0@m6805> Message-ID: <0JCA00K8QVGEU3C3@l-daemon> Hi John: To my understanding there are real fixed length fields. Sizes can be fixed to a maximum like varchar(4000) but only the amount of space that is actually being used is being allocated. The defining of field types is more for display format, structure, management, relationship and functionality ... Internally, as far as I know, all the field/objects have variable length. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 5:36 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] varchar vs char Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 21:00:16 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 22:00:16 -0500 Subject: [dba-SQLServer] Delete from a "not in" view Message-ID: <001801c73e9a$9c5b8e00$657aa8c0@m6805> I have a set of tables. tblSurvey contains 65 million records, about 600 fields, from "big table" which was 65 million records but which contained about 100 now useless fields. I.e. I made a smaller table by copying 600 of 700 fields. I included the original integer autoincrement PK from the big table into tblSurvey. I have a second table that took people / address info from "big table" and processed it to eliminate bad addresses, turning it into tblAZ. tblAZ now contains about 53 million records, including the PK from Big Table. So tblAZ contains 53 million records ALL OF WHICH contain known valid addresses, and which is a subset of the records in Big Table. So... I want to eliminate any records in tblSurvey where the PKID is not found in tblAZ. The PKs from tblSurvey and tblAZ both came from Big Table. Thus it is a classic "not in", where I want to eliminate records in tblSurvey where PKID is inner joined to tblAZ, and where tblAZ PKID is null. Unfortunately, SQL Server says that such a "not in" query is not updateable, which means I can't delete records in tblSurvey, nor can I create a blank field which I update to True if the PK is not in tblAZ. Why is this query not updateable, and how do I accomplish my objective? Again I need to eliminate all survey records where the PK is not in a table that has been address validated (tblAZ) and which contains fewer records than tblSurvey. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Mon Jan 22 21:13:35 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 22:13:35 -0500 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <20070123020300.14578.qmail@web88211.mail.re2.yahoo.com> Message-ID: <001d01c73e9c$790bb860$657aa8c0@m6805> Actually this is not really the question. Of course a field that always contains a fixed number of characters should be char. But take the case of a field that holds manufacturer codes. The codes may contain anywhere from 4 to 10 letters. Char, or varchar? If the range is 4 to 7 characters - char or varchar. IOW, there must be a cost associated with the "variable length" property of the varchar field. At what point does it become more expensive (processing time / index processing / whatever costs you can think of) to process a varchar than it does to just make it a fixed width field? Additionally what happens to the extra unused characters? Are they nulls, spaces, or something else? IOW, if making the field a char really means "padding right with char X" then there is the issue of how to do where clauses ("ASDF " or "ASDF") etc. This is more of an "educate me on the mechanics" question. Remember I come from Access where all strings are varchar so I am trying to come to grips with the "what really happens" that I suddenly have to deal with. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 22, 2007 9:03 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] varchar vs char AFAIK it has more to do with indexes than with storage. Assuming some column such as Zip 5+4 (i.e. total 9 chars, ignoring the dash) then there is IMO no point in declaring this varchar. Better to declare it either: a) zip 5 (not null) + zip 4 (null); or b) zip 9. The former lets you create a covering index consisting of z5 + z4. The latter gives maximal performance for one precise code, and also for the z5 codes, which should be aligned on one or more pages. These may sound similar but they are different. It depends on how you want to retrieve the data. One might imagine a query such as "select all the clients living in a zip code whose proportion of BMW-ownership is in the TOP 5 zip codes". This could occur because my client is in the business of reselling parts to BMW owners. I might be interested in zip5+4 precisely, or alternatively I might be interested in zip5 and want the zip4 part sorted. Impossible to predict this beforehand. Interrogate the client, discover the data that yields the maximum customer service (e.g. money to be made), and deliver accordingly. In the absence of expert input from the crucial stakeholders, you're guessing about a business you don't comprehend. That's my $.02 anyway. In such meetings, despite all my instincts, I try to shut up and listen. Hear what matters. Sift the stakeholders from the wannabes. Find out what causes the organization to live or die. Focus on that. All else is trivial. A. ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 8:35:53 PM Subject: [dba-SQLServer] varchar vs char Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Mon Jan 22 21:29:06 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 19:29:06 -0800 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <20070123020300.14578.qmail@web88211.mail.re2.yahoo.com> Message-ID: <0JCA009IZXL7A733@l-daemon> Hi Arthur: You expressed a couple of very interesting points. Data concepts as related to and from the perception of the client. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 22, 2007 6:03 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] varchar vs char AFAIK it has more to do with indexes than with storage. Assuming some column such as Zip 5+4 (i.e. total 9 chars, ignoring the dash) then there is IMO no point in declaring this varchar. Better to declare it either: a) zip 5 (not null) + zip 4 (null); or b) zip 9. The former lets you create a covering index consisting of z5 + z4. The latter gives maximal performance for one precise code, and also for the z5 codes, which should be aligned on one or more pages. These may sound similar but they are different. It depends on how you want to retrieve the data. One might imagine a query such as "select all the clients living in a zip code whose proportion of BMW-ownership is in the TOP 5 zip codes". This could occur because my client is in the business of reselling parts to BMW owners. I might be interested in zip5+4 precisely, or alternatively I might be interested in zip5 and want the zip4 part sorted. Impossible to predict this beforehand. Interrogate the client, discover the data that yields the maximum customer service (e.g. money to be made), and deliver accordingly. In the absence of expert input from the crucial stakeholders, you're guessing about a business you don't comprehend. That's my $.02 anyway. In such meetings, despite all my instincts, I try to shut up and listen. Hear what matters. Sift the stakeholders from the wannabes. Find out what causes the organization to live or die. Focus on that. All else is trivial. A. ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 8:35:53 PM Subject: [dba-SQLServer] varchar vs char Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From stuart at lexacorp.com.pg Mon Jan 22 21:34:23 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 23 Jan 2007 13:34:23 +1000 Subject: [dba-SQLServer] Delete from a "not in" view In-Reply-To: <001801c73e9a$9c5b8e00$657aa8c0@m6805> References: <001801c73e9a$9c5b8e00$657aa8c0@m6805> Message-ID: <45B60EDF.20264.299D359E@stuart.lexacorp.com.pg> On 22 Jan 2007 at 22:00, JWColby wrote: > I want to eliminate any records in tblSurvey where the PKID is not found in > tblAZ. The PKs from tblSurvey and tblAZ both came from Big Table. Thus it > is a classic "not in", where I want to eliminate records in tblSurvey where > PKID is inner joined to tblAZ, and where tblAZ PKID is null. > If it's an Inner Join, there will be no records in tblAZ where PKID is null! > Unfortunately, SQL Server says that such a "not in" query is not updateable, > which means I can't delete records in tblSurvey, nor can I create a blank > field which I update to True if the PK is not in tblAZ. > > Why is this query not updateable, and how do I accomplish my objective? What is your SQL? This will work: delete from tblSurvey from tblSurvey left join tblAZ on tblSurvey.pkid = tblAZ.pkid where tblAZ.pkid is null From stuart at lexacorp.com.pg Mon Jan 22 21:42:56 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 23 Jan 2007 13:42:56 +1000 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <001d01c73e9c$790bb860$657aa8c0@m6805> References: <20070123020300.14578.qmail@web88211.mail.re2.yahoo.com>, <001d01c73e9c$790bb860$657aa8c0@m6805> Message-ID: <45B610E0.29167.29A508BB@stuart.lexacorp.com.pg> On 22 Jan 2007 at 22:13, JWColby wrote: > But take the case of a field that holds manufacturer codes. The codes may > contain anywhere from 4 to 10 letters. Char, or varchar? If the range is 4 > to 7 characters - char or varchar. IOW, there must be a cost associated > with the "variable length" property of the varchar field. At what point > does it become more expensive (processing time / index processing / whatever > costs you can think of) to process a varchar than it does to just make it a > fixed width field? > > Additionally what happens to the extra unused characters? Are they nulls, > spaces, or something else? IOW, if making the field a char really means > "padding right with char X" then there is the issue of how to do where > clauses ("ASDF " or "ASDF") etc. > A few pointers from http://www.sql-server-performance.com/datatypes.asp If the text data in a column varies greatly in length, use a VARCHAR data type instead of a CHAR data type. The amount of space saved by using VARCHAR over CHAR on variable length columns can greatly reduce I/O reads cache memory used to hold data, improving overall SQL Server performance. Another advantage of using VARCHAR over CHAR columns is that sorts performed on VARCHAR columns are generally faster than on CHAR columns. This is because the entire width of a CHAR column needs to be sorted. [6.5, 7.0, 2000] Updated 8-21-2005. ***** If a column's data does not vary widely in length, consider using a fixed-length CHAR field instead of a VARCHAR. While it may take up a little more space to store the data, processing fixed-length columns is faster in SQL Server than processing variable-length columns. [6.5, 7.0, 2000] Updated 8-21-2005 If you are using fixed length columns (CHAR, NCHAR) in your table, do your best to avoid storing NULLs in them. If you do, the entire amount of space dedicated to the column will be used up. For example, if you have a fixed length column of 255 characters, and if you place a NULL in it, then 255 characters have to be stored in the database. This is a large waste of space that will cause SQL Server to have to perform extra disk I/O to read data pages. It also wastes space in the data cache buffer. Both of these contribute to reduced SQL Server performance. Instead of using NULLs, use a coding scheme similar to this in your databases: * NA: Not applicable * NYN: Not yet known * TUN: Truly unknown Such a scheme provides the benefits of using NULLs, but without the drawbacks. If you really must use NULLs, use a variable length column instead of a fixed length column. (I doubt your reason for using Nulls is very good.) Variable length columns only use a very small amount of space to store a NULL. [7.0, 2000] Updated 5-15- 2006 From accessd at shaw.ca Mon Jan 22 22:04:59 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 22 Jan 2007 20:04:59 -0800 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <001d01c73e9c$790bb860$657aa8c0@m6805> Message-ID: <0JCA009TMZ8ZA930@l-daemon> Hi John: I do not think unused character space is used. It is difficult to estimate when there is so much overhead. I believe the a varchar(1000) with the value 'ABC' takes as much room as varchar(3) with the same value. It would be an interesting experiment. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Monday, January 22, 2007 7:14 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] varchar vs char Actually this is not really the question. Of course a field that always contains a fixed number of characters should be char. But take the case of a field that holds manufacturer codes. The codes may contain anywhere from 4 to 10 letters. Char, or varchar? If the range is 4 to 7 characters - char or varchar. IOW, there must be a cost associated with the "variable length" property of the varchar field. At what point does it become more expensive (processing time / index processing / whatever costs you can think of) to process a varchar than it does to just make it a fixed width field? Additionally what happens to the extra unused characters? Are they nulls, spaces, or something else? IOW, if making the field a char really means "padding right with char X" then there is the issue of how to do where clauses ("ASDF " or "ASDF") etc. This is more of an "educate me on the mechanics" question. Remember I come from Access where all strings are varchar so I am trying to come to grips with the "what really happens" that I suddenly have to deal with. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 22, 2007 9:03 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] varchar vs char AFAIK it has more to do with indexes than with storage. Assuming some column such as Zip 5+4 (i.e. total 9 chars, ignoring the dash) then there is IMO no point in declaring this varchar. Better to declare it either: a) zip 5 (not null) + zip 4 (null); or b) zip 9. The former lets you create a covering index consisting of z5 + z4. The latter gives maximal performance for one precise code, and also for the z5 codes, which should be aligned on one or more pages. These may sound similar but they are different. It depends on how you want to retrieve the data. One might imagine a query such as "select all the clients living in a zip code whose proportion of BMW-ownership is in the TOP 5 zip codes". This could occur because my client is in the business of reselling parts to BMW owners. I might be interested in zip5+4 precisely, or alternatively I might be interested in zip5 and want the zip4 part sorted. Impossible to predict this beforehand. Interrogate the client, discover the data that yields the maximum customer service (e.g. money to be made), and deliver accordingly. In the absence of expert input from the crucial stakeholders, you're guessing about a business you don't comprehend. That's my $.02 anyway. In such meetings, despite all my instincts, I try to shut up and listen. Hear what matters. Sift the stakeholders from the wannabes. Find out what causes the organization to live or die. Focus on that. All else is trivial. A. ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 22, 2007 8:35:53 PM Subject: [dba-SQLServer] varchar vs char Is there a rule of thumb for where it is better to use a fixed width rather than a variable width field? Something like... "if a field may be more than 5 characters"? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Mon Jan 22 22:11:09 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 22 Jan 2007 23:11:09 -0500 Subject: [dba-SQLServer] varchar vs char In-Reply-To: <45B610E0.29167.29A508BB@stuart.lexacorp.com.pg> Message-ID: <002701c73ea4$838ea1f0$657aa8c0@m6805> Thanks for that, interesting stuff. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Monday, January 22, 2007 10:43 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] varchar vs char On 22 Jan 2007 at 22:13, JWColby wrote: > But take the case of a field that holds manufacturer codes. The codes > may contain anywhere from 4 to 10 letters. Char, or varchar? If the > range is 4 to 7 characters - char or varchar. IOW, there must be a > cost associated with the "variable length" property of the varchar > field. At what point does it become more expensive (processing time / > index processing / whatever costs you can think of) to process a > varchar than it does to just make it a fixed width field? > > Additionally what happens to the extra unused characters? Are they > nulls, spaces, or something else? IOW, if making the field a char > really means "padding right with char X" then there is the issue of how to do where > clauses ("ASDF " or "ASDF") etc. > A few pointers from http://www.sql-server-performance.com/datatypes.asp If the text data in a column varies greatly in length, use a VARCHAR data type instead of a CHAR data type. The amount of space saved by using VARCHAR over CHAR on variable length columns can greatly reduce I/O reads cache memory used to hold data, improving overall SQL Server performance. Another advantage of using VARCHAR over CHAR columns is that sorts performed on VARCHAR columns are generally faster than on CHAR columns. This is because the entire width of a CHAR column needs to be sorted. [6.5, 7.0, 2000] Updated 8-21-2005. ***** If a column's data does not vary widely in length, consider using a fixed-length CHAR field instead of a VARCHAR. While it may take up a little more space to store the data, processing fixed-length columns is faster in SQL Server than processing variable-length columns. [6.5, 7.0, 2000] Updated 8-21-2005 If you are using fixed length columns (CHAR, NCHAR) in your table, do your best to avoid storing NULLs in them. If you do, the entire amount of space dedicated to the column will be used up. For example, if you have a fixed length column of 255 characters, and if you place a NULL in it, then 255 characters have to be stored in the database. This is a large waste of space that will cause SQL Server to have to perform extra disk I/O to read data pages. It also wastes space in the data cache buffer. Both of these contribute to reduced SQL Server performance. Instead of using NULLs, use a coding scheme similar to this in your databases: * NA: Not applicable * NYN: Not yet known * TUN: Truly unknown Such a scheme provides the benefits of using NULLs, but without the drawbacks. If you really must use NULLs, use a variable length column instead of a fixed length column. (I doubt your reason for using Nulls is very good.) Variable length columns only use a very small amount of space to store a NULL. [7.0, 2000] Updated 5-15- 2006 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Tue Jan 23 07:46:20 2007 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Tue, 23 Jan 2007 07:46:20 -0600 Subject: [dba-SQLServer] varchar vs char In-Reply-To: References: Message-ID: <200701231347.l0NDlGR31488@databaseadvisors.com> John, Use varchar, period. If you use char, you will have to search on the entire column or do LIKE for any of the searching. There is no real good reason to use char. Robert At 09:29 PM 1/22/2007, you wrote: >Date: Mon, 22 Jan 2007 20:35:53 -0500 >From: "JWColby" >Subject: [dba-SQLServer] varchar vs char >To: >Message-ID: <000c01c73e8e$d3a7b4d0$657aa8c0 at m6805> >Content-Type: text/plain; charset="us-ascii" > >Is there a rule of thumb for where it is better to use a fixed width rather >than a variable width field? Something like... "if a field may be more than >5 characters"? > >John W. Colby >Colby Consulting >www.ColbyConsulting.com From newsgrps at dalyn.co.nz Wed Jan 24 19:18:57 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 25 Jan 2007 14:18:57 +1300 Subject: [dba-SQLServer] Rolling Back Transactions Message-ID: <20070125011642.JCEW19636.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> Group, SQL2000 - We had a situation where a client ran a procedure that changed a large number of transactions. When it was finished she realised that she made a mistake, and wanted to be able to undo the changes. No backup was made of the database just prior the changes of the records (although we do have earlier backups and transaction logs). Does SQL have a facility to be able to undo the changes? I tried looking through Books Online but could only find restoring from previous backups and transaction logs. I couldn't see anything about undoing transactions, or restoring parts of transaction logs. From michael at ddisolutions.com.au Wed Jan 24 19:44:09 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 25 Jan 2007 12:44:09 +1100 Subject: [dba-SQLServer] Rolling Back Transactions References: <20070125011642.JCEW19636.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AF3E@ddi-01.DDI.local> David, http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlbackup rest.mspx#ET2AE Restoring Transaction Log Backups to a Point in Time Transaction log backups may be restored to a point-in-time. This functionality is available only through the use of transaction log backups. There are certain restrictions placed upon using point-in-time recovery as follows: * Point-in-time recovery may not be used in conjunction with file/filegroup restore. The tail of transaction log has to be applied in full when recovering file/filegroups from file/filegroup backups. For more information, see "File/Filegroup Backups" later in this paper. * Point-in-time recovery is only available as the last step in a recovery situation. This means that no further backups may be restored if point-in-time recovery is used. The database is recovered immediately even if the NORECOVERY or STANDBY option is specified. Point-in-time recovery is implemented using the STOPAT option with the RESTORE LOG Transact-SQL statement. The SQL Enterprise Manager dialog box shown in Figure 33 is used to perform a point-in-time restore. This dialog box is displayed when the Point in time restorecheck box is selected in the dialog box shown in Figure 28. Select the appropriate date and time to stop the transaction log restore operation through this dialog box. Once the date time is selected, click OK to continue with the restore operation. Note Since this procedure results in a different ending transaction after the restore is complete, a full database backup should be performed before any further transaction log backups. cheers Michael M Group, SQL2000 - We had a situation where a client ran a procedure that changed a large number of transactions. When it was finished she realised that she made a mistake, and wanted to be able to undo the changes. No backup was made of the database just prior the changes of the records (although we do have earlier backups and transaction logs). Does SQL have a facility to be able to undo the changes? I tried looking through Books Online but could only find restoring from previous backups and transaction logs. I couldn't see anything about undoing transactions, or restoring parts of transaction logs. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Wed Jan 24 20:49:54 2007 From: newsgrps at dalyn.co.nz (David Emerson) Date: Thu, 25 Jan 2007 15:49:54 +1300 Subject: [dba-SQLServer] Rolling Back Transactions In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0116AF3E@ddi-01.DDI.local> References: <20070125011642.JCEW19636.fep02.xtra.co.nz@Dalyn.dalyn.co.nz> <59A61174B1F5B54B97FD4ADDE71E7D0116AF3E@ddi-01.DDI.local> Message-ID: <20070125024730.LIMY6965.fep05.xtra.co.nz@Dalyn.dalyn.co.nz> Thanks Michael. At 25/01/2007, you wrote: > David, > >http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlbackup >rest.mspx#ET2AE >Restoring Transaction Log Backups to a Point in Time > >Transaction log backups may be restored to a point-in-time. This >functionality is available only through the use of transaction log >backups. There are certain restrictions placed upon using point-in-time >recovery as follows: >* > >Point-in-time recovery may not be used in conjunction with >file/filegroup restore. The tail of transaction log has to be applied in >full when recovering file/filegroups from file/filegroup backups. For >more information, see "File/Filegroup Backups" later in this paper. >* > >Point-in-time recovery is only available as the last step in a recovery >situation. This means that no further backups may be restored if >point-in-time recovery is used. The database is recovered immediately >even if the NORECOVERY or STANDBY option is specified. > >Point-in-time recovery is implemented using the STOPAT option with the >RESTORE LOG Transact-SQL statement. The SQL Enterprise Manager dialog >box shown in Figure 33 is used to perform a point-in-time restore. > >This dialog box is displayed when the Point in time restorecheck box is >selected in the dialog box shown in Figure 28. > >Select the appropriate date and time to stop the transaction log restore >operation through this dialog box. Once the date time is selected, click >OK to continue with the restore operation. > >Note Since this procedure results in a different ending transaction >after the restore is complete, a full database backup should be >performed before any further transaction log backups. > >cheers > > >Michael M > >Group, > >SQL2000 - We had a situation where a client ran a procedure that changed >a large number of transactions. When it was finished she realised that >she made a mistake, and wanted to be able to undo the changes. No >backup was made of the database just prior the changes of the records >(although we do have earlier backups and transaction logs). > >Does SQL have a facility to be able to undo the changes? I tried >looking through Books Online but could only find restoring from previous >backups and transaction logs. I couldn't see anything about undoing >transactions, or restoring parts of transaction logs. > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com From martyconnelly at shaw.ca Thu Jan 25 14:45:03 2007 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 25 Jan 2007 12:45:03 -0800 Subject: [dba-SQLServer] Route Planning In-Reply-To: <20070121053226.15570.qmail@web88209.mail.re2.yahoo.com> References: <20070121053226.15570.qmail@web88209.mail.re2.yahoo.com> Message-ID: <45B916CF.8040905@shaw.ca> Have a look at MapInfo's Routing Server They have an office in Toronto. They don't list prices. artful at rogers.com wrote: >I am well acquainted with the TSP problem, and have written some Genetic Algorithms to solve it, but they all depend on a pre-existing databases of distances between cities, and thus are not appropriate. I thought that maybe MapQuest or MapPoint had these distances built-in. Actually, they both do. They simply (or complexly) have not applied the TSP algorithms to them. Maybe that's an extension that could be for sale. I was hoping that it already was, but if not, then since I am well acquainted with the problem, maybe that's my next project. > >A. > >----- Original Message ---- >From: Jim Lawrence >To: dba-sqlserver at databaseadvisors.com >Sent: Saturday, January 20, 2007 10:08:22 PM >Subject: Re: [dba-SQLServer] Route Planning > >Hi Marty: > >My Gawd where do you come up with this stuff... Quite impressive but scary. >:-) > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of >MartyConnelly >Sent: Saturday, January 20, 2007 5:34 PM >To: dba-sqlserver at databaseadvisors.com >Subject: Re: [dba-SQLServer] Route Planning > >Most of these programs will plot a route but not compute the optimum >route. For this you need the TSP (Traveling Salesman Problem) algorithm >The TSP is an NP-complete problem, it could be done on google maps. >but I have not seen any JavaScript code to solve this, it would be hairy. > >I have some quick VBA code that will display a route via Virtual Earth >with driving distances I can post, > > >Why is it difficult for optimising?? > >If you know the distances of the routes, or are happy to work with >straight line distances, then obtaining the solution for a small >number of points can be achieved by running a simple exhaustive search. >The problem with the travelling salesman is that an exhaustive search >algorithm needs to examine (n-1)!/2 possible routes. So for 6 markers >there's 60 possibilities to be checked, but for 12 markers there's just >short of 20 million, and for 18 markers there's nearly 15 trillion >possibilities. By the time you get to the classic problem of visiting >all the US state capitals the amount of processing involved in an >exhaustive search becomes somewhat impractical but has been >done and quicker algorithms have replaced the original solution >from the late 50's > >You could try this > >Concode TSP for Windows program >http://www.tsp.gatech.edu/concorde/gui/gui.htm > > >artful at rogers.com wrote: > > > >>Does anyone know whether such software as MapQuest or MapPoint provides a >> >> >way to plan a route (such as a Fedex truck delivery route) that would >optimize for least distance? From what I can see, MapPoint expects you to >plan the route. What I had in mind was piping in 20 addresses and having it >do the planning. > > >>TIA, >>Arthur >> >> >> >> >> >> > > > -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Fri Jan 26 09:01:06 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Fri, 26 Jan 2007 10:01:06 -0500 Subject: [dba-SQLServer] Top1 Message-ID: <00bd01c7415a$cebca4c0$657aa8c0@m6805> I have a dataset where I have multiple addresses, multiple people living at the same address. "Address" is defined as "Address1,zip5,zip4". Is it possible to directly create a result set with just the first record at each address? John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jan 27 07:53:22 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Sat, 27 Jan 2007 08:53:22 -0500 Subject: [dba-SQLServer] sql server 2K backup files Message-ID: <014001c7421a$82b23b10$657aa8c0@m6805> I have a 100gb backup file that I don't need. Can I just delete the actual file (it is a .bak file buried down in the sql server directory structure. John W. Colby Colby Consulting www.ColbyConsulting.com From artful at rogers.com Sat Jan 27 18:06:59 2007 From: artful at rogers.com (artful at rogers.com) Date: Sat, 27 Jan 2007 16:06:59 -0800 (PST) Subject: [dba-SQLServer] sql server 2K backup files Message-ID: <20070128000659.90880.qmail@web88210.mail.re2.yahoo.com> Yes. Or copy it or move it. Whatever you wish. ----- Original Message ---- From: JWColby To: dba-sqlserver at databaseadvisors.com Sent: Saturday, January 27, 2007 8:53:22 AM Subject: [dba-SQLServer] sql server 2K backup files I have a 100gb backup file that I don't need. Can I just delete the actual file (it is a .bak file buried down in the sql server directory structure. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Mon Jan 29 07:28:14 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 29 Jan 2007 05:28:14 -0800 (PST) Subject: [dba-SQLServer] Fine Tune SQL Server Query Performance Message-ID: <20070129132814.81773.qmail@web88207.mail.re2.yahoo.com> The take-away to this article from SSWUG is amusing: The query performance of the database is an important part of database development. There are some simple features you can use to increase the response time. Discussed here are the use of indexes, stored procedures and triggers. One normally doesn't wish to increase the response time, unless the CPU and disk are simply too quick for the user to handle. Arthur From jwcolby at colbyconsulting.com Mon Jan 29 07:36:55 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Mon, 29 Jan 2007 08:36:55 -0500 Subject: [dba-SQLServer] Fine Tune SQL Server Query Performance In-Reply-To: <20070129132814.81773.qmail@web88207.mail.re2.yahoo.com> Message-ID: <008e01c743aa$8b15c6f0$657aa8c0@m6805> ROTFL. I know that MY server is simply TOO FAST. Slow it down please! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 29, 2007 8:28 AM To: swynk at sswug.org Cc: Steve Giles; Dejan Sunderic; dba-SQLServer; Valentin CK; Alexander Karmanov; Andrei Pascal Subject: [dba-SQLServer] Fine Tune SQL Server Query Performance The take-away to this article from SSWUG is amusing: The query performance of the database is an important part of database development. There are some simple features you can use to increase the response time. Discussed here are the use of indexes, stored procedures and triggers. One normally doesn't wish to increase the response time, unless the CPU and disk are simply too quick for the user to handle. Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Mon Jan 29 14:41:34 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 29 Jan 2007 12:41:34 -0800 (PST) Subject: [dba-SQLServer] Paean to the Access Development Team Message-ID: <20070129204134.22555.qmail@web88214.mail.re2.yahoo.com> In the beginning were Relational Databases -- a valiant attempt by the late and lamented Dr. Edgar (Ted) Codd. His set-based theories changed the database world. I wish he had lived 20 more years, so he could address the new issues. (He did try, late in life, to address the OODB issues, but didn't survive long enough to complete his arguments.) Yes, Dr. Codd rationalized the world of databases as viewed from set theory. But the most important and radical of Dr. Codd's propositions was that statement X ought to work in implementations Y and Z. Vendors and their marketing staff view the world differently. Thus they foisted upon Dr. Codd's universal language the Language Extension. And the Language Extensions proliferated, on grounds similar to brand-name crack or heroin dealers in Manhattan. The new mantra: "Adhere to the standards, but toss in a few really addictive commands that are way cool and extend the language in proprietary ways." Dr. Codd's rules were thus undermined by the capitalist system, at every possible step. "Offer tempting extensions that force or at least coerce total buy-in." Make it difficult or impossible to port code-X from implementation Y to implementation Z. To the extent that you buy in, you are our captive market. Any reasonable (i.e. non-marketing) person would agree that this approach totally violates everything Dr. Codd's achievements stood for. As an IBM Fellow, Dr. Codd was above and beyond the fray of market competition. He thought only of the big picture. Smaller minds plundered his ideas and the result is an array of variants upon commands that ought to have been standard across all implementations. The ISO SQL projects notwithstanding, virtually every vendor persists in redefining or extending the language in proprietary ways. I have a tiny book published by O'Reilly and written by Jonathan Gennick, which is a Prince Valiant attempt to sort all this out and provide a Rosetta Stone. Thank you, Sir Jonathan! You have saved those cross-implementation readers such as I hundreds or even thousands of hours of investigative time. To be objective, there are one or two subjects you haven't covered, but you are the Valiant of the SQL Wars! I began in dBASE not SQL (and expect that many readers will immediately slight me for my origins), but even back then the strategic path was the same. Wayne Ratliff and Jeb Long invented a language based on JPL-DIS. It was called Vulcan, but after one ad in Byte magazine they discovered that Harris Computing owned the name. Enter Hal Pollock, a marketing genious. He suggested the name dBASE II, on the grounds that no one would buy dBASE 1.0. He also created the legendary "bilge pump" ad. dBASE II took over the CP/M and then DOS world by storm. A couple of years later, a vastly superior product called KnowledgeMan came along, but could not compete against Pollock's brilliant marketing of dBASE II. Despite numerous interanl arguments, Ashton-Tate refused to release a compiler, and committed seppukku. A couple of frustrated, not to mention opportunity-sensitive, A-T employees, met in a restaurant called Nantucket, and to conceive and devise a compiler for dBASE. The result was Clipper, from Nantucket Software. I bought into Nantucket big-time (not in shares but in development hours). I wrote two books about Clipper, and I like to pretend that I helped lead the way for these folks into O-O programming, but in reality I borrowed lessons learned from playing with SmallTalk and other O-O languages. The point is, Brian and Rich and Barry realized that the way to capture the market is to provide 98% compatibility with dBASE syntax, but also offer totally addictive extensions, which delivered much more power but also trapped the developer into Clipper. The Clipper code would not readily port to FoxPro or dbCompiler and most certainly not into dBASE. So, to the extent that one bought in to the extensions -- and I bought in, big time, because they were so powerful -- one excluded porting the code to other variants of dBASE. Jump-cut to the SQL world. Oracle releases Java extensions. MS releases .NET extensions. Sybase struggles to tread water (not a slight on their team -- they are underfunded and carry the albatross of PowerBuilder compatibility, etc.) and Borland tries to find a way to fit. Later, Gupta and Clarion and a dozen others. The market is a vicious place. The world is not flat, and here is an interesting example. Although I know nothing about MS internal development and even less about the development hierarchy, what I can deduce from outside is that the MS-Access team is seen as a wart, if not a threat, to the marketing of all the .NET stuff. This, in my view, is most unfortunate. Admittedly, there are things that an Access expert cannot implement, but that covers the 20% of the people who insist upon a BMW or better. The "Chevrolet" set would be most pleased to learn that an Access developer can deliver a functional application for approximately 1/10 the cost of the equivalent app developed in .NET. The C# and VB.NET developers don't like to acknowledge this, nor does Microsoft. But facts are facts. If you need to deliver a shrink-wrapped package that depends on nothing (a laughable concept in itself, but let's let that pass), then C# or VB.NET are the languages of choice. But if you need to deliver something quickly and easily changed in the light of revised requirements, then I vote Access as the best available platform. There is no problem in directly connecting it to the SQL Server database of choice. Granted, an Access developer cannot deliver an executable. This distinction matters, apparently, to those who would bill you 10 times as much for an equivalent project. I cannot understand why Microsoft continues (over the past decade at least) to slight the achievements possible in Access. This particular newsgroup is ALL about what can be done in Access. I can cite numerous developers here who have bolstered my argument, but I will cite only a few and hope those whose contributions I didn't cite will forgive me): Bartow, Brock, Connelly, Carbonell, Colby, Der, Enright, Fields, Foust, Harkins, Kjos, Hindman, Lacey, Lawrence, Matte, Mattys, McLachlan, Reid, Salakhetitov, Skolits, Smolin, Tapia, Tejpal, Williamson, Wutka. I wish all the best to MS-Access development team, and I hope that one or two or three of said team occasionally visits our group, to learn how much we appreciate their efforts, and to know that we understand what challenges they face. All the marketing $ focus on .NET (which is very cool - no slight on that team intended) but the Access team delivers top-quality stuff in spite of its underfunding. Hats off to the Access development team. Without you, many of us would be in serious financial trouble. Thanks to you, we can make a living. You give us the tools and we discover ingenious ways to use them. My $.02. Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com From mwp.reid at qub.ac.uk Mon Jan 29 15:00:21 2007 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Mon, 29 Jan 2007 21:00:21 -0000 Subject: [dba-SQLServer] Paean to the Access Development Team References: <20070129204134.22555.qmail@web88214.mail.re2.yahoo.com> Message-ID: Arthur for whats it worth I sent that email to them. Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 From artful at rogers.com Mon Jan 29 15:25:13 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 29 Jan 2007 13:25:13 -0800 (PST) Subject: [dba-SQLServer] Paean to the Access Development Team Message-ID: <20070129212513.73175.qmail@web88206.mail.re2.yahoo.com> Thanks! Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com ----- Original Message ---- From: Martin Reid To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 29, 2007 4:00:21 PM Subject: Re: [dba-SQLServer] Paean to the Access Development Team Arthur for whats it worth I sent that email to them. Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 From michael at ddisolutions.com.au Mon Jan 29 17:50:37 2007 From: michael at ddisolutions.com.au (Michael Maddison) Date: Tue, 30 Jan 2007 10:50:37 +1100 Subject: [dba-SQLServer] Paean to the Access Development Team References: <20070129212513.73175.qmail@web88206.mail.re2.yahoo.com> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0116AF59@ddi-01.DDI.local> Hi Arthur, Nice article. It was only yesterday I made the 'mistake' of suggesting MS Access as a solution to a potential clients problem. They told me they didn't use Access because it was too slow and they didn't like it... I'm now committed to a C# solution, sadly I wont charge 10x the Access price but it will easily cost more. much much more hehehehe I know they are wrong but they insist... They also don't want to use FTP to move a bunch of files from their clients. The clients are internal but remote ie not attached to network. VPN has also been nixed. Anyone know how to get Exchange to place attachments sent to a specific mailbox in a specified folder? This is related to SQL because the attachments have data in them that will end up in SQL 2K ;-) cheers Michael M Thanks! Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com ----- Original Message ---- From: Martin Reid To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 29, 2007 4:00:21 PM Subject: Re: [dba-SQLServer] Paean to the Access Development Team Arthur for whats it worth I sent that email to them. Martin Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Mon Jan 29 18:59:19 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 29 Jan 2007 16:59:19 -0800 (PST) Subject: [dba-SQLServer] Paean to the Access Development Team Message-ID: <20070130005919.32548.qmail@web88208.mail.re2.yahoo.com> Thanks for the compliment. I wish I could be more useful in your battle against fossilized minds. Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com ----- Original Message ---- From: Michael Maddison To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 29, 2007 6:50:37 PM Subject: Re: [dba-SQLServer] Paean to the Access Development Team Hi Arthur, Nice article. It was only yesterday I made the 'mistake' of suggesting MS Access as a solution to a potential clients problem. They told me they didn't use Access because it was too slow and they didn't like it... I'm now committed to a C# solution, sadly I wont charge 10x the Access price but it will easily cost more. much much more hehehehe I know they are wrong but they insist... They also don't want to use FTP to move a bunch of files from their clients. The clients are internal but remote ie not attached to network. VPN has also been nixed. Anyone know how to get Exchange to place attachments sent to a specific mailbox in a specified folder? This is related to SQL because the attachments have data in them that will end up in SQL 2K ;-) cheers Michael M Thanks! From accessd at shaw.ca Mon Jan 29 16:01:55 2007 From: accessd at shaw.ca (Jim Lawrence) Date: Mon, 29 Jan 2007 14:01:55 -0800 Subject: [dba-SQLServer] Paean to the Access Development Team In-Reply-To: <20070129204134.22555.qmail@web88214.mail.re2.yahoo.com> Message-ID: <0JCN00LNPH313Y51@l-daemon> Hi Arthur: Much of what you say makes good sense... well said. Mind you that was no .02 cents worth... related to previous List contributions, an estimated $6.38 would be a more appropriate figure. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of artful at rogers.com Sent: Monday, January 29, 2007 12:42 PM To: AccessD at databaseadvisors. com Cc: dba-SQLServer Subject: [dba-SQLServer] Paean to the Access Development Team In the beginning were Relational Databases -- a valiant attempt by the late and lamented Dr. Edgar (Ted) Codd. His set-based theories changed the database world. I wish he had lived 20 more years, so he could address the new issues. (He did try, late in life, to address the OODB issues, but didn't survive long enough to complete his arguments.) Yes, Dr. Codd rationalized the world of databases as viewed from set theory. But the most important and radical of Dr. Codd's propositions was that statement X ought to work in implementations Y and Z. Vendors and their marketing staff view the world differently. Thus they foisted upon Dr. Codd's universal language the Language Extension. And the Language Extensions proliferated, on grounds similar to brand-name crack or heroin dealers in Manhattan. The new mantra: "Adhere to the standards, but toss in a few really addictive commands that are way cool and extend the language in proprietary ways." Dr. Codd's rules were thus undermined by the capitalist system, at every possible step. "Offer tempting extensions that force or at least coerce total buy-in." Make it difficult or impossible to port code-X from implementation Y to implementation Z. To the extent that you buy in, you are our captive market. Any reasonable (i.e. non-marketing) person would agree that this approach totally violates everything Dr. Codd's achievements stood for. As an IBM Fellow, Dr. Codd was above and beyond the fray of market competition. He thought only of the big picture. Smaller minds plundered his ideas and the result is an array of variants upon commands that ought to have been standard across all implementations. The ISO SQL projects notwithstanding, virtually every vendor persists in redefining or extending the language in proprietary ways. I have a tiny book published by O'Reilly and written by Jonathan Gennick, which is a Prince Valiant attempt to sort all this out and provide a Rosetta Stone. Thank you, Sir Jonathan! You have saved those cross-implementation readers such as I hundreds or even thousands of hours of investigative time. To be objective, there are one or two subjects you haven't covered, but you are the Valiant of the SQL Wars! I began in dBASE not SQL (and expect that many readers will immediately slight me for my origins), but even back then the strategic path was the same. Wayne Ratliff and Jeb Long invented a language based on JPL-DIS. It was called Vulcan, but after one ad in Byte magazine they discovered that Harris Computing owned the name. Enter Hal Pollock, a marketing genious. He suggested the name dBASE II, on the grounds that no one would buy dBASE 1.0. He also created the legendary "bilge pump" ad. dBASE II took over the CP/M and then DOS world by storm. A couple of years later, a vastly superior product called KnowledgeMan came along, but could not compete against Pollock's brilliant marketing of dBASE II. Despite numerous interanl arguments, Ashton-Tate refused to release a compiler, and committed seppukku. A couple of frustrated, not to mention opportunity-sensitive, A-T employees, met in a restaurant called Nantucket, and to conceive and devise a compiler for dBASE. The result was Clipper, from Nantucket Software. I bought into Nantucket big-time (not in shares but in development hours). I wrote two books about Clipper, and I like to pretend that I helped lead the way for these folks into O-O programming, but in reality I borrowed lessons learned from playing with SmallTalk and other O-O languages. The point is, Brian and Rich and Barry realized that the way to capture the market is to provide 98% compatibility with dBASE syntax, but also offer totally addictive extensions, which delivered much more power but also trapped the developer into Clipper. The Clipper code would not readily port to FoxPro or dbCompiler and most certainly not into dBASE. So, to the extent that one bought in to the extensions -- and I bought in, big time, because they were so powerful -- one excluded porting the code to other variants of dBASE. Jump-cut to the SQL world. Oracle releases Java extensions. MS releases .NET extensions. Sybase struggles to tread water (not a slight on their team -- they are underfunded and carry the albatross of PowerBuilder compatibility, etc.) and Borland tries to find a way to fit. Later, Gupta and Clarion and a dozen others. The market is a vicious place. The world is not flat, and here is an interesting example. Although I know nothing about MS internal development and even less about the development hierarchy, what I can deduce from outside is that the MS-Access team is seen as a wart, if not a threat, to the marketing of all the .NET stuff. This, in my view, is most unfortunate. Admittedly, there are things that an Access expert cannot implement, but that covers the 20% of the people who insist upon a BMW or better. The "Chevrolet" set would be most pleased to learn that an Access developer can deliver a functional application for approximately 1/10 the cost of the equivalent app developed in .NET. The C# and VB.NET developers don't like to acknowledge this, nor does Microsoft. But facts are facts. If you need to deliver a shrink-wrapped package that depends on nothing (a laughable concept in itself, but let's let that pass), then C# or VB.NET are the languages of choice. But if you need to deliver something quickly and easily changed in the light of revised requirements, then I vote Access as the best available platform. There is no problem in directly connecting it to the SQL Server database of choice. Granted, an Access developer cannot deliver an executable. This distinction matters, apparently, to those who would bill you 10 times as much for an equivalent project. I cannot understand why Microsoft continues (over the past decade at least) to slight the achievements possible in Access. This particular newsgroup is ALL about what can be done in Access. I can cite numerous developers here who have bolstered my argument, but I will cite only a few and hope those whose contributions I didn't cite will forgive me): Bartow, Brock, Connelly, Carbonell, Colby, Der, Enright, Fields, Foust, Harkins, Kjos, Hindman, Lacey, Lawrence, Matte, Mattys, McLachlan, Reid, Salakhetitov, Skolits, Smolin, Tapia, Tejpal, Williamson, Wutka. I wish all the best to MS-Access development team, and I hope that one or two or three of said team occasionally visits our group, to learn how much we appreciate their efforts, and to know that we understand what challenges they face. All the marketing $ focus on .NET (which is very cool - no slight on that team intended) but the Access team delivers top-quality stuff in spite of its underfunding. Hats off to the Access development team. Without you, many of us would be in serious financial trouble. Thanks to you, we can make a living. You give us the tools and we discover ingenious ways to use them. My $.02. Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Mon Jan 29 19:33:32 2007 From: artful at rogers.com (artful at rogers.com) Date: Mon, 29 Jan 2007 17:33:32 -0800 (PST) Subject: [dba-SQLServer] Paean to the Access Development Team Message-ID: <20070130013332.47483.qmail@web88208.mail.re2.yahoo.com> LOL. I was hoping for $8 but I see now where I stand in the hierarchy. O well. Arthur Fuller Technical Writer, Data Modeler, SQL Sensei Artful Databases Organization www.artfulsoftware.com ----- Original Message ---- From: Jim Lawrence To: dba-sqlserver at databaseadvisors.com Sent: Monday, January 29, 2007 5:01:55 PM Subject: Re: [dba-SQLServer] Paean to the Access Development Team Hi Arthur: Much of what you say makes good sense... well said. Mind you that was no .02 cents worth... related to previous List contributions, an estimated $6.38 would be a more appropriate figure. Jim From stuart at lexacorp.com.pg Mon Jan 29 23:25:24 2007 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 30 Jan 2007 15:25:24 +1000 Subject: [dba-SQLServer] Paean to the Access Development Team In-Reply-To: <20070130013332.47483.qmail@web88208.mail.re2.yahoo.com> References: <20070130013332.47483.qmail@web88208.mail.re2.yahoo.com> Message-ID: <45BF6364.17631.4E0F5ECC@stuart.lexacorp.com.pg> Wouldn't $US6.38 would be about $CAD8.00 anyway? On 29 Jan 2007 at 17:33, artful at rogers.com wrote: > LOL. I was hoping for $8 but I see now where I stand in the hierarchy. O well. > > Arthur Fuller > Technical Writer, Data Modeler, SQL Sensei > Artful Databases Organization > www.artfulsoftware.com > > > > > ----- Original Message ---- > From: Jim Lawrence > To: dba-sqlserver at databaseadvisors.com > Sent: Monday, January 29, 2007 5:01:55 PM > Subject: Re: [dba-SQLServer] Paean to the Access Development Team > > > Hi Arthur: > > Much of what you say makes good sense... well said. Mind you that was no .02 > cents worth... related to previous List contributions, an estimated $6.38 > would be a more appropriate figure. > > Jim From jwcolby at colbyconsulting.com Wed Jan 31 07:44:44 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 31 Jan 2007 08:44:44 -0500 Subject: [dba-SQLServer] Alter column Message-ID: <003e01c7453d$f8c3eda0$657aa8c0@m6805> Can the alter column SQL syntax change a column name? John W. Colby Colby Consulting www.ColbyConsulting.com From mwp.reid at qub.ac.uk Wed Jan 31 07:51:07 2007 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 31 Jan 2007 13:51:07 -0000 Subject: [dba-SQLServer] Alter column References: <003e01c7453d$f8c3eda0$657aa8c0@m6805> Message-ID: EXEC sp_rename 'MyTable.OldColumnName', 'NewColumnName', 'COLUMN' for reference http://doc.ddart.net/mssql/sql70/sp_ra-rz_11.htm Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: dba-sqlserver-bounces at databaseadvisors.com on behalf of JWColby Sent: Wed 31/01/2007 13:44 To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Alter column Can the alter column SQL syntax change a column name? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Wed Jan 31 08:23:44 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 31 Jan 2007 09:23:44 -0500 Subject: [dba-SQLServer] Alter column In-Reply-To: Message-ID: <005201c74543$6c82b820$657aa8c0@m6805> Bueno. So SQL per se does not but a SP can. Done! Thanks. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Martin Reid Sent: Wednesday, January 31, 2007 8:51 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Alter column EXEC sp_rename 'MyTable.OldColumnName', 'NewColumnName', 'COLUMN' for reference http://doc.ddart.net/mssql/sql70/sp_ra-rz_11.htm Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974477 ________________________________ From: dba-sqlserver-bounces at databaseadvisors.com on behalf of JWColby Sent: Wed 31/01/2007 13:44 To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Alter column Can the alter column SQL syntax change a column name? John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Wed Jan 31 08:31:28 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 31 Jan 2007 09:31:28 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Aggregate queries in query designer Message-ID: <005f01c74544$7f49bca0$657aa8c0@m6805> I am not seeing any way to do aggregate queries from the query designer. Am I missing something? I can do it from the designer in views. John W. Colby Colby Consulting www.ColbyConsulting.com From fhtapia at gmail.com Wed Jan 31 11:42:35 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 31 Jan 2007 09:42:35 -0800 Subject: [dba-SQLServer] SQL Server 2005 - Aggregate queries in query designer In-Reply-To: <005f01c74544$7f49bca0$657aa8c0@m6805> References: <005f01c74544$7f49bca0$657aa8c0@m6805> Message-ID: Are you referring to SELECT SUM(Field1), Field2, Field3 FROM SomeWickedBigTable Where Field2 = 'SomeText' Group By Field2, Field3 On 1/31/07, JWColby wrote: > I am not seeing any way to do aggregate queries from the query designer. Am > I missing something? I can do it from the designer in views. > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From fhtapia at gmail.com Wed Jan 31 11:46:42 2007 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 31 Jan 2007 09:46:42 -0800 Subject: [dba-SQLServer] Alter column In-Reply-To: <005201c74543$6c82b820$657aa8c0@m6805> References: <005201c74543$6c82b820$657aa8c0@m6805> Message-ID: Yes, except that renaming columns, is generally not the way to do the renaming, if you do it via Enterprise Manager OR, Studio Manager, what the script does, is it creates a NEW table w, the columns in the order (and renamed columns) you want, it then uses the sp_rename to rename the actual table. This is to keep the systable names organized. As a general rule you do not want to rename sprocs, I've just continued using that rule for most objects in sql server. On 1/31/07, JWColby wrote: > Bueno. So SQL per se does not but a SP can. > > Done! > > Thanks. > > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Martin Reid > Sent: Wednesday, January 31, 2007 8:51 AM > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] Alter column > > EXEC sp_rename 'MyTable.OldColumnName', 'NewColumnName', 'COLUMN' > > for reference > > http://doc.ddart.net/mssql/sql70/sp_ra-rz_11.htm > > Martin WP Reid > Training and Assessment Unit > Riddle Hall > Belfast > > tel: 02890 974477 > > > ________________________________ > > From: dba-sqlserver-bounces at databaseadvisors.com on behalf of JWColby > Sent: Wed 31/01/2007 13:44 > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer] Alter column > > > > Can the alter column SQL syntax change a column name? > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... From jwcolby at colbyconsulting.com Wed Jan 31 12:00:36 2007 From: jwcolby at colbyconsulting.com (JWColby) Date: Wed, 31 Jan 2007 13:00:36 -0500 Subject: [dba-SQLServer] SQL Server 2005 - Aggregate queries in querydesigner In-Reply-To: Message-ID: <008d01c74561$b6a0bc40$657aa8c0@m6805> Yes, but in the view designer there is a button that creates the aggregate columns. In the query designer there is not, that I can see. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia Sent: Wednesday, January 31, 2007 12:43 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Server 2005 - Aggregate queries in querydesigner Are you referring to SELECT SUM(Field1), Field2, Field3 FROM SomeWickedBigTable Where Field2 = 'SomeText' Group By Field2, Field3 On 1/31/07, JWColby wrote: > I am not seeing any way to do aggregate queries from the query > designer. Am I missing something? I can do it from the designer in views. > > John W. Colby > Colby Consulting > www.ColbyConsulting.com > > -- -Francisco http://sqlthis.blogspot.com | Tsql and More... _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com