From jwcolby at colbyconsulting.com Thu Oct 1 10:27:35 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 01 Oct 2009 11:27:35 -0400 Subject: [dba-SQLServer] Multi-column Clustered index Message-ID: <4AC4CA67.9070909@colbyconsulting.com> I am reading an article about clustered indexes which recommend against setting multi-column clustered indexes where possible. My understanding is that if data is in a clustered index then the data can be directly obtained from that index rather than having to go to the table itself. My understanding is also that the organization of a clustered index is much more efficient than the organization of the rest of the table. I commonly have tables where I have: PK, FName, LName, Addr, City, St, Zip5, Zip4, HashAddr, HashFamily, HashPerson Doesn't it makes sense to just place every single field in this table in a clustered index. In that case every field of every record is available from the index and thus no retrieval of field data would need to go to the table itself. If it does make sense, is it possible to get rid of the actual table and ONLY have the clustered index remain? Is that possible? -- John W. Colby www.ColbyConsulting.com From robert at webedb.com Thu Oct 1 13:56:19 2009 From: robert at webedb.com (Robert Stewart) Date: Thu, 01 Oct 2009 13:56:19 -0500 Subject: [dba-SQLServer] SQL Server speed issues In-Reply-To: References: Message-ID: <200910011856.n91IubaJ000826@databaseadvisors.com> Here is the code to run as an SP to truncate you log file. Truncate is not automatic with shrink. CREATE PROCEDURE [DBO].[usp_Truncate_Log] AS BEGIN EXEC sp_dboption 'SSMS_BCAM' , 'trunc. log on chkpt.','TRUE' END BEGIN CHECKPOINT END BEGIN EXEC sp_dboption 'SSMS_BCAM' , 'trunc. log on chkpt.','FALSE' END BEGIN DBCC SHRINKFILE(SSMS_Log,1) END GO Replace SSMS_BCAM with the name of your DB Replace SSMS_Log with the name of the log file. Running the SP above every-so-often in your code will keep them smaller. Also, running things so that you can use transactions might allow you to commit them more often and reduce the size of the temdb to hold all of it before committing it at the end of the process. The tempdb is where everything is stored. It shrinks back down to the 600+ meg after it is finished doing what it does. You need to check the size of it as you are performing the processing to see how big it really gets. At 12:00 PM 10/1/2009, you wrote: >Date: Wed, 30 Sep 2009 15:14:14 -0400 >From: jwcolby >Subject: Re: [dba-SQLServer] SQL Server speed issues - was server > locking >To: Discussion concerning MS SQL Server > >Message-ID: <4AC3AE06.7080407 at colbyconsulting.com> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Sorry Robert, I didn't answer the questions. > >The log files get huge pretty quickly. In use I don't really care >as that is what they are for. >However as I have mentioned, the application is really static >data. I get tables of addresses, send >them out for address validation, pull the resulting data (includes >but more than the original >addresses), process the data and then... just use the data for >"quite awhile", then send out for >address validation again, process the results and then... just use >the data for "quite awhile". >There are zero "transactions" in the normal sense. The resulting >data are read-only for weeks or >months at a time. > >So under normal circumstances I want to use the log files, then "do >whatever" to get them to as >close as possible to zero bytes. Truncate, shrink, doesn't matter >to me as long as it works. > >In the past the log files were always 99% available and I just used >the shrink wizard. I do need to >automate this process so that when the address validation process >finishes, it TRUNCATES the log >file as the final process. The log file will not be used again for >weeks or more so why leave it huge. > > >> How big is your log file? > >That depends on what is going on, how many records in the table >being processed etc. For this >specific process for this specific database, for 20 million records, >about 15 GB when it is all >finished. > > >> Have you truncated it? > >Not in so many words. I have never run any code with the TRUNCATE >keyword. I have always used the >"shrink files" dialog from inside of SS. My understanding is that >the wizard performed a TRUNCATE >behind the scenes but who am I to say? I will almost certainly do >so eventually. > > >> How big is your space for the tempdb file? > >The temp db runs on a separate raid0 array, two 320g drives, >apparently waaaayyyy to big for the >requirements. The array is 600 gb and the temp db (after all this >horsing around) is currently 640 >mb. The temp db is the only thing on that array. > >My log files run on another array. Raid1, using two 500gb drives >for a total of 500gb available. >That array is used only for the log files, though all of the log >files are on that one array. At >this instant the total space used for logs is 16 GB, though I have >seen a single log file get as big >as 100 GB under heaving processing as I am setting up a large (100 >million record) database. When >done I just shrink the log back down though. > >The main DATA array is a raid6 array of six 1 tb drives, divided >into two 2 tb volumes. All the >data files are on one of the two volumes. The other volume is used >for general data storage. Given >that both of the two terabyte volumes are on the same array (set of >spindles) my understanding is >that it doesn't matter if they are all on the same volume. > >The system drive is on its own array, Raid1, using two 1 tb >drives. That array is divided into two >volumes, 300g for boot (C:) and 700g for data. The main SQL Server >installation is on that C: >drive, with the master database etc on that volume. > >And then there is a 1 tb backup drive sitting on the end of an ESATA >cable in an external enclosure. > >All of the RAID arrays are on a single ARECA controller card with 2 >gigs of RAM onboard. One thing >I want to try is to move the raid arrays for the logs and tempdb off >to a second controller card >which I have sitting on the shelf. That would put it on a separate >co-processor, and a separate >PCI-Express x8 interface to the processor. Unfortunately that >second controller has only a fixed >256 MB of memory available to it, and I don't know whether to put >the data or the logs on the bigger >card. And of course just touching stuff that is working is always a risk. > >John W. Colby >www.ColbyConsulting.com > From robert at webedb.com Thu Oct 1 14:02:55 2009 From: robert at webedb.com (Robert Stewart) Date: Thu, 01 Oct 2009 14:02:55 -0500 Subject: [dba-SQLServer] Multi-column Clustered index In-Reply-To: References: Message-ID: <200910011903.n91J3Df3002314@databaseadvisors.com> Did you also read that the table is ordered in the same sequence as the clustered index? Try inserting Ansel Adams into your table with a clustered index like you have, and it has to move the millions of records in it down alphabetically in order to do it. Disaster for performance. If you have static data where you are not inserting rows or updating columns in the clustered index, and, you place in the clustered index on it after you are finished getting the data into the table, it might work well. But never for a non-static data source. No, you cannot get rid of the table and only have the index. At 12:00 PM 10/1/2009, you wrote: >Date: Thu, 01 Oct 2009 11:27:35 -0400 >From: jwcolby >Subject: [dba-SQLServer] Multi-column Clustered index >To: Dba-Sqlserver >Message-ID: <4AC4CA67.9070909 at colbyconsulting.com> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >I am reading an article about clustered indexes which recommend >against setting multi-column >clustered indexes where possible. My understanding is that if data >is in a clustered index then the >data can be directly obtained from that index rather than having to >go to the table itself. My >understanding is also that the organization of a clustered index is >much more efficient than the >organization of the rest of the table. > >I commonly have tables where I have: > >PK, FName, LName, Addr, City, St, Zip5, Zip4, HashAddr, HashFamily, HashPerson > >Doesn't it makes sense to just place every single field in this >table in a clustered index. In that >case every field of every record is available from the index and >thus no retrieval of field data >would need to go to the table itself. > >If it does make sense, is it possible to get rid of the actual table >and ONLY have the clustered >index remain? Is that possible? > >-- >John W. Colby >www.ColbyConsulting.com From jwcolby at colbyconsulting.com Thu Oct 1 14:40:07 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 01 Oct 2009 15:40:07 -0400 Subject: [dba-SQLServer] Multi-column Clustered index In-Reply-To: <200910011903.n91J3Df3002314@databaseadvisors.com> References: <200910011903.n91J3Df3002314@databaseadvisors.com> Message-ID: <4AC50597.4090109@colbyconsulting.com> Robert, That is exactly the situation. These tables are entirely static, no insertions or deletions ever take place. Once the initial processing, there aren't even any updates. Read-only. John W. Colby www.ColbyConsulting.com Robert Stewart wrote: > Did you also read that the table is ordered in the same sequence as > the clustered index? > > Try inserting Ansel Adams into your table with a clustered index like > you have, and it has to move the millions of records in it down > alphabetically in order to do it. Disaster for performance. If you > have static data where you are not inserting rows or updating columns > in the clustered index, and, you place in the clustered index on it > after you are finished getting the data into the table, it might work > well. But never for a non-static data source. > > No, you cannot get rid of the table and only have the index. > > > At 12:00 PM 10/1/2009, you wrote: >> Date: Thu, 01 Oct 2009 11:27:35 -0400 >> From: jwcolby >> Subject: [dba-SQLServer] Multi-column Clustered index >> To: Dba-Sqlserver >> Message-ID: <4AC4CA67.9070909 at colbyconsulting.com> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> >> I am reading an article about clustered indexes which recommend >> against setting multi-column >> clustered indexes where possible. My understanding is that if data >> is in a clustered index then the >> data can be directly obtained from that index rather than having to >> go to the table itself. My >> understanding is also that the organization of a clustered index is >> much more efficient than the >> organization of the rest of the table. >> >> I commonly have tables where I have: >> >> PK, FName, LName, Addr, City, St, Zip5, Zip4, HashAddr, HashFamily, HashPerson >> >> Doesn't it makes sense to just place every single field in this >> table in a clustered index. In that >> case every field of every record is available from the index and >> thus no retrieval of field data >> would need to go to the table itself. >> >> If it does make sense, is it possible to get rid of the actual table >> and ONLY have the clustered >> index remain? Is that possible? >> >> -- >> John W. Colby >> 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 Oct 1 20:03:22 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 01 Oct 2009 21:03:22 -0400 Subject: [dba-SQLServer] SQL Server not locking up Message-ID: <4AC5515A.3070008@colbyconsulting.com> I am hesitantly declaring victory in the SQL Server war. I am going to award Nancy Lytle the award for the correct solution, with the proviso that she has to give it back if it turns out that the wily server misbehaves again. Since setting Max Degree of Parallelism to 3 I have not been locked out again. Understand that about this same time I also changed processor I/O affinity to only use the same three CPUs that I set CPU affinity for. And I have had so many problems with this, where it went away and then came back that I am very hesitant to declare victory but I did want to report back that the "locking up" issue hasn't recurred lately. Thanks go to everyone who volunteered suggestions. -- John W. Colby www.ColbyConsulting.com From paul.hartland at googlemail.com Fri Oct 2 03:29:20 2009 From: paul.hartland at googlemail.com (Paul Hartland) Date: Fri, 2 Oct 2009 09:29:20 +0100 Subject: [dba-SQLServer] SQL Server 2005 Update Trigger Message-ID: <38c884770910020129t28fcca0cj77e1a12d273c0c70@mail.gmail.com> To all, Only really done very basic work with triggers on SQL Server, I have an audit table where the trigger will records updates to & a table where if a certain column gets updated the trigger will fire, and record on the audit table. Is there anyway I can get the name of the stored procedure or the application that caused the update so that I can also log this in my audit table. Thank you in advance for any help on this. -- Paul Hartland paul.hartland at googlemail.com From nancy.lytle at gmail.com Fri Oct 2 06:58:50 2009 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Fri, 2 Oct 2009 06:58:50 -0500 Subject: [dba-SQLServer] SQL Server not locking up In-Reply-To: <4AC5515A.3070008@colbyconsulting.com> References: <4AC5515A.3070008@colbyconsulting.com> Message-ID: Thanks John. I know that solution has worked for me, and it is one that is often over looked. If it ever acts up again you could drop it one more, down to 2. But hopefully you have hit the sweet spot already. Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOOD Join me > Date: Thu, 1 Oct 2009 21:03:22 -0400 > From: jwcolby at colbyconsulting.com > To: dba-sqlserver at databaseadvisors.com; dba-vb at databaseadvisors.com; accessd at databaseadvisors.com > Subject: [dba-SQLServer] SQL Server not locking up > > I am hesitantly declaring victory in the SQL Server war. I am going to award Nancy Lytle the award > for the correct solution, with the proviso that she has to give it back if it turns out that the > wily server misbehaves again. Since setting Max Degree of Parallelism to 3 I have not been locked > out again. Understand that about this same time I also changed processor I/O affinity to only use > the same three CPUs that I set CPU affinity for. > > And I have had so many problems with this, where it went away and then came back that I am very > hesitant to declare victory but I did want to report back that the "locking up" issue hasn't > recurred lately. > > Thanks go to everyone who volunteered suggestions. > > -- > John W. Colby > 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 Fri Oct 2 07:13:38 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 02 Oct 2009 08:13:38 -0400 Subject: [dba-SQLServer] SQL Server not locking up In-Reply-To: References: <4AC5515A.3070008@colbyconsulting.com> Message-ID: <4AC5EE72.6060905@colbyconsulting.com> Nancy, The server (machine) is for SQL Server so it makes sense to give SS as much power as you reasonably can. John W. Colby www.ColbyConsulting.com Nancy Lytle wrote: > Thanks John. I know that solution has worked for me, and it is one that is often over looked. If it ever acts up again you could drop it one more, down to 2. But hopefully you have hit the sweet spot already. > > Nancy Lytle > N_Lytle at terpalum.umd.edu > > > > > > > > > > EMAILING FOR THE GREATER GOOD > Join me > >> Date: Thu, 1 Oct 2009 21:03:22 -0400 >> From: jwcolby at colbyconsulting.com >> To: dba-sqlserver at databaseadvisors.com; dba-vb at databaseadvisors.com; accessd at databaseadvisors.com >> Subject: [dba-SQLServer] SQL Server not locking up >> >> I am hesitantly declaring victory in the SQL Server war. I am going to award Nancy Lytle the award >> for the correct solution, with the proviso that she has to give it back if it turns out that the >> wily server misbehaves again. Since setting Max Degree of Parallelism to 3 I have not been locked >> out again. Understand that about this same time I also changed processor I/O affinity to only use >> the same three CPUs that I set CPU affinity for. >> >> And I have had so many problems with this, where it went away and then came back that I am very >> hesitant to declare victory but I did want to report back that the "locking up" issue hasn't >> recurred lately. >> >> Thanks go to everyone who volunteered suggestions. >> >> -- >> John W. Colby >> 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 nancy.lytle at gmail.com Fri Oct 2 07:23:28 2009 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Fri, 2 Oct 2009 07:23:28 -0500 Subject: [dba-SQLServer] SQL Server not locking up In-Reply-To: <4AC5EE72.6060905@colbyconsulting.com> References: <4AC5515A.3070008@colbyconsulting.com> Message-ID: I keep forgetting most people have actual dedicated SQL machines. My SQL machines are file servers, application servers, IIS servers, and SQL Servers, so there is a lot to spread around. Just glad you got it working for your needs. Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOOD Join me > Date: Fri, 2 Oct 2009 08:13:38 -0400 > From: jwcolby at colbyconsulting.com > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] SQL Server not locking up > > Nancy, > > The server (machine) is for SQL Server so it makes sense to give SS as much power as you reasonably > can. > > John W. Colby > www.ColbyConsulting.com > > > Nancy Lytle wrote: > > Thanks John. I know that solution has worked for me, and it is one that is often over looked. If it ever acts up again you could drop it one more, down to 2. But hopefully you have hit the sweet spot already. > > > > Nancy Lytle > > N_Lytle at terpalum.umd.edu > > > > > > > > > > > > > > > > > > > > EMAILING FOR THE GREATER GOOD > > Join me > > > >> Date: Thu, 1 Oct 2009 21:03:22 -0400 > >> From: jwcolby at colbyconsulting.com > >> To: dba-sqlserver at databaseadvisors.com; dba-vb at databaseadvisors.com; accessd at databaseadvisors.com > >> Subject: [dba-SQLServer] SQL Server not locking up > >> > >> I am hesitantly declaring victory in the SQL Server war. I am going to award Nancy Lytle the award > >> for the correct solution, with the proviso that she has to give it back if it turns out that the > >> wily server misbehaves again. Since setting Max Degree of Parallelism to 3 I have not been locked > >> out again. Understand that about this same time I also changed processor I/O affinity to only use > >> the same three CPUs that I set CPU affinity for. > >> > >> And I have had so many problems with this, where it went away and then came back that I am very > >> hesitant to declare victory but I did want to report back that the "locking up" issue hasn't > >> recurred lately. > >> > >> Thanks go to everyone who volunteered suggestions. > >> > >> -- > >> John W. Colby > >> 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 Tue Oct 6 07:37:19 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 06 Oct 2009 08:37:19 -0400 Subject: [dba-SQLServer] Top 25 most dangerous programming errors Message-ID: <4ACB39FF.5030302@colbyconsulting.com> I just stumbled across this today. I'll be reading through them to see what i can learn. http://cwe.mitre.org/top25/ -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Tue Oct 6 16:34:40 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 06 Oct 2009 17:34:40 -0400 Subject: [dba-SQLServer] Transactions Message-ID: <4ACBB7F0.8090507@colbyconsulting.com> Is it possible to tell SQL Server to use transactions inside of a single query? I routinely do things like update a single field for 50 million records. It might be beneficial to be able to tell SQL Server to commit the updates every N million records. I have no idea whether it is possible, or if it is what the results would be but I thought it worth asking the question. Can it be done? Would it make any difference. -- John W. Colby www.ColbyConsulting.com From davidmcafee at gmail.com Tue Oct 6 16:51:10 2009 From: davidmcafee at gmail.com (David McAfee) Date: Tue, 6 Oct 2009 14:51:10 -0700 Subject: [dba-SQLServer] Transactions In-Reply-To: <4ACBB7F0.8090507@colbyconsulting.com> References: <4ACBB7F0.8090507@colbyconsulting.com> Message-ID: <8786a4c00910061451g48a9580cs8a8e6d43cf5a91be@mail.gmail.com> BEGIN TRAN JC1 SELECT Something INSERT INTO TABLE tblSomeTable SELECT SOMETHING UPDATE tblSomewthing SET Something = SOmethingElse ROLLBACK TRAN JC1 --If everything works as expected, comment above line and uncomment next line --COMMIT TRAN JC1 On Tue, Oct 6, 2009 at 2:34 PM, jwcolby wrote: > Is it possible to tell SQL Server to use transactions inside of a single query? > > I routinely do things like update a single field for 50 million records. ?It might be beneficial to > be able to tell SQL Server to commit the updates every N million records. ?I have no idea whether it > is possible, or if it is what the results would be but I thought it worth asking the question. > > Can it be done? ?Would it make any difference. > > -- > John W. Colby > www.ColbyConsulting.com > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fhtapia at gmail.com Tue Oct 6 16:59:10 2009 From: fhtapia at gmail.com (Francisco Tapia) Date: Tue, 6 Oct 2009 14:59:10 -0700 Subject: [dba-SQLServer] Transactions In-Reply-To: <8786a4c00910061451g48a9580cs8a8e6d43cf5a91be@mail.gmail.com> References: <4ACBB7F0.8090507@colbyconsulting.com> <8786a4c00910061451g48a9580cs8a8e6d43cf5a91be@mail.gmail.com> Message-ID: One minor change, (see below) also follow this link http://msdn.microsoft.com/en-us/library/aa175920%28SQL.80%29.aspx -Francisco http://sqlthis.blogspot.com | Tsql and More... On Tue, Oct 6, 2009 at 2:51 PM, David McAfee wrote: > BEGIN TRAN JC1 > > SELECT Something > > INSERT INTO TABLE tblSomeTable > SELECT SOMETHING > > UPDATE tblSomewthing SET Something = SOmethingElse > > IF @@ERROR <> 0 > BEGIN > ROLLBACK TRAN JC1 > END ELSE BEGIN COMMIT TRAN JC1 END > > > > On Tue, Oct 6, 2009 at 2:34 PM, jwcolby > wrote: > > Is it possible to tell SQL Server to use transactions inside of a single > query? > > > > I routinely do things like update a single field for 50 million records. > It might be beneficial to > > be able to tell SQL Server to commit the updates every N million records. > I have no idea whether it > > is possible, or if it is what the results would be but I thought it worth > asking the question. > > > > Can it be done? Would it make any difference. > > > > -- > > John W. Colby > > 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 Tue Oct 6 19:39:12 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 06 Oct 2009 20:39:12 -0400 Subject: [dba-SQLServer] Transactions In-Reply-To: <8786a4c00910061451g48a9580cs8a8e6d43cf5a91be@mail.gmail.com> References: <4ACBB7F0.8090507@colbyconsulting.com> <8786a4c00910061451g48a9580cs8a8e6d43cf5a91be@mail.gmail.com> Message-ID: <4ACBE330.8010600@colbyconsulting.com> No David, this is manually breaking the insert down into X separate insert queries, then wrapping each in a transaction. I am talking about a SINGLE insert or a SINGLE Update SQL Statement where 50 million records are going to be inserted or updated, but where SQL Server stops every 10 million records and performs the insert or update for the first 10 million records, then again 10 million records later etc. John W. Colby www.ColbyConsulting.com David McAfee wrote: > BEGIN TRAN JC1 > > SELECT Something > > INSERT INTO TABLE tblSomeTable > SELECT SOMETHING > > UPDATE tblSomewthing SET Something = SOmethingElse > > > ROLLBACK TRAN JC1 > --If everything works as expected, comment above line and uncomment next line > --COMMIT TRAN JC1 > > On Tue, Oct 6, 2009 at 2:34 PM, jwcolby wrote: >> Is it possible to tell SQL Server to use transactions inside of a single query? >> >> I routinely do things like update a single field for 50 million records. It might be beneficial to >> be able to tell SQL Server to commit the updates every N million records. I have no idea whether it >> is possible, or if it is what the results would be but I thought it worth asking the question. >> >> Can it be done? Would it make any difference. >> >> -- >> John W. Colby >> 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 Wed Oct 7 07:23:52 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Oct 2009 08:23:52 -0400 Subject: [dba-SQLServer] Drop index in another database Message-ID: <4ACC8858.6080203@colbyconsulting.com> I am attempting to write a stored procedure that exists in a database of stored procedures. This stored procedure needs to create an index on a table in a database and table which are passed in parameters, update a field in that database / table, then drop the index when done. In studying the drop index syntax it clearly states "in the current database". Does SQL (the language) not have syntax for dropping an index in a table in a different database from the one the SQL statement exists in? Is it possible to use something like Use @DBName to cause this to work? Is there something else I should be doing (other than a different line of work ;) -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Wed Oct 7 07:31:10 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Oct 2009 08:31:10 -0400 Subject: [dba-SQLServer] Drop index in another database In-Reply-To: <4ACC8858.6080203@colbyconsulting.com> References: <4ACC8858.6080203@colbyconsulting.com> Message-ID: <4ACC8A0E.20209@colbyconsulting.com> Sorry guys, I found it as soon as I pressed send. Thanks, John W. Colby www.ColbyConsulting.com jwcolby wrote: > I am attempting to write a stored procedure that exists in a database of stored procedures. This > stored procedure needs to create an index on a table in a database and table which are passed in > parameters, update a field in that database / table, then drop the index when done. > > In studying the drop index syntax it clearly states "in the current database". > > Does SQL (the language) not have syntax for dropping an index in a table in a different database > from the one the SQL statement exists in? > > Is it possible to use something like > > Use @DBName to cause this to work? > > Is there something else I should be doing (other than a different line of work ;) > From james at fcidms.com Wed Oct 7 08:06:46 2009 From: james at fcidms.com (James Barash) Date: Wed, 7 Oct 2009 09:06:46 -0400 Subject: [dba-SQLServer] Transactions In-Reply-To: <4ACBB7F0.8090507@colbyconsulting.com> Message-ID: <12D2F894654B53498DEF840AE12B7BB320AF1D61@fciexchange.fcidms.com> John: Yes, it can be done. It can help to keep the transaction log files from getting too large. You just need a way to determine which records have already been updated. The following will update 1,000,000 records per transaction. James Barash Set rowcount 1000000 Declare @rc int Set @rc=1000000 While @rc=1000000 Begin Begin Transaction Update MyTable Set MyField = 0 From MyTable Where MyField <> 0 Select @rc=@@rowcount Commit Transaction End -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, October 06, 2009 5:35 PM To: Dba-Sqlserver Subject: [dba-SQLServer] Transactions Is it possible to tell SQL Server to use transactions inside of a single query? I routinely do things like update a single field for 50 million records. It might be beneficial to be able to tell SQL Server to commit the updates every N million records. I have no idea whether it is possible, or if it is what the results would be but I thought it worth asking the question. Can it be done? Would it make any difference. -- John W. Colby 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 Oct 7 09:49:36 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Oct 2009 10:49:36 -0400 Subject: [dba-SQLServer] Transactions In-Reply-To: <12D2F894654B53498DEF840AE12B7BB320AF1D61@fciexchange.fcidms.com> References: <12D2F894654B53498DEF840AE12B7BB320AF1D61@fciexchange.fcidms.com> Message-ID: <4ACCAA80.10106@colbyconsulting.com> Cool, thanks James. John W. Colby www.ColbyConsulting.com James Barash wrote: > John: > Yes, it can be done. It can help to keep the transaction log files from getting too large. You just need a way to determine which records have already been updated. The following will update 1,000,000 records per transaction. > > James Barash > > Set rowcount 1000000 > > Declare @rc int > Set @rc=1000000 > > While @rc=1000000 > Begin > > Begin Transaction > > Update MyTable > Set MyField = 0 > From MyTable > Where MyField <> 0 > > Select @rc=@@rowcount > > Commit Transaction > End > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Tuesday, October 06, 2009 5:35 PM > To: Dba-Sqlserver > Subject: [dba-SQLServer] Transactions > > Is it possible to tell SQL Server to use transactions inside of a single query? > > I routinely do things like update a single field for 50 million records. It might be beneficial to be able to tell SQL Server to commit the updates every N million records. I have no idea whether it is possible, or if it is what the results would be but I thought it worth asking the question. > > Can it be done? Would it make any difference. > > -- > John W. Colby > 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 Wed Oct 7 10:19:24 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Oct 2009 11:19:24 -0400 Subject: [dba-SQLServer] Error logging Message-ID: <4ACCB17C.8000208@colbyconsulting.com> I have reached the point where I need to start logging processes (SQL Statements) and any errors encountered in my stored procedures. I typically run stored procedures where I will create a field in a table, create an index to facilitate updating that field, update the field, then drop the index. There can be many processes in that stored procedure, 4 or 5 or more. I want to log after each step. My concept is to build a ProcessLog table where I log the process itself. This table would hold things like ProcName, ProcMemo, ProcDate, ErrInt, ErrStr. It seems logical to create a stored procedure to call after each process completes or in the Catch statement in order to log errors. This stored procedure would accept parameters and actually write to the log table. The process steps usually take a long time, often minutes or even tens of minutes, thus the time to log each one is not an issue. I assume that many of you do something similar so I am asking for guidance or advice for how you handle this. -- John W. Colby www.ColbyConsulting.com From mikedorism at verizon.net Wed Oct 7 17:41:44 2009 From: mikedorism at verizon.net (Doris Manning) Date: Wed, 07 Oct 2009 18:41:44 -0400 Subject: [dba-SQLServer] Error logging In-Reply-To: <4ACCB17C.8000208@colbyconsulting.com> References: <4ACCB17C.8000208@colbyconsulting.com> Message-ID: <7F79D348C6C84CACA1ECB57B9ADBC6B0@Kermit> If you check @@Error after each step of the process, you can do it all within the SP itself. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, October 07, 2009 11:19 AM To: Dba-Sqlserver Subject: [dba-SQLServer] Error logging I have reached the point where I need to start logging processes (SQL Statements) and any errors encountered in my stored procedures. I typically run stored procedures where I will create a field in a table, create an index to facilitate updating that field, update the field, then drop the index. There can be many processes in that stored procedure, 4 or 5 or more. I want to log after each step. My concept is to build a ProcessLog table where I log the process itself. This table would hold things like ProcName, ProcMemo, ProcDate, ErrInt, ErrStr. It seems logical to create a stored procedure to call after each process completes or in the Catch statement in order to log errors. This stored procedure would accept parameters and actually write to the log table. The process steps usually take a long time, often minutes or even tens of minutes, thus the time to log each one is not an issue. I assume that many of you do something similar so I am asking for guidance or advice for how you handle this. -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From dwaters at usinternet.com Thu Oct 8 07:08:10 2009 From: dwaters at usinternet.com (Dan Waters) Date: Thu, 8 Oct 2009 07:08:10 -0500 Subject: [dba-SQLServer] Export from SQL to Access - Include Table Relationships? Message-ID: Hello Everyone! I found out how to export data tables from SQL to Access using SSIS. However, the table relationships did not come across. Is there a method in SQL or Access to quickly copy tables from SQL to Access and include the table relationships? Thanks! Dan From robert at webedb.com Thu Oct 8 13:45:29 2009 From: robert at webedb.com (Robert Stewart) Date: Thu, 08 Oct 2009 13:45:29 -0500 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: References: Message-ID: <200910081845.n98Ijl90008851@databaseadvisors.com> http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlecode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan From robert at webedb.com Thu Oct 8 14:11:52 2009 From: robert at webedb.com (Robert Stewart) Date: Thu, 08 Oct 2009 14:11:52 -0500 Subject: [dba-SQLServer] Export from SQL to Access Message-ID: <200910081912.n98JC8hM014168@databaseadvisors.com> You might also try Visio Professional. At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan From dwaters at usinternet.com Thu Oct 8 15:52:52 2009 From: dwaters at usinternet.com (Dan Waters) Date: Thu, 8 Oct 2009 15:52:52 -0500 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: <200910081845.n98Ijl90008851@databaseadvisors.com> References: <200910081845.n98Ijl90008851@databaseadvisors.com> Message-ID: <3CB806116449458895A7BCF04D65CEBF@danwaters> Hi Rob, I tried to get this to connect to sqlexpress on my PC, but after an hour it's still not working. I'll try again later. Thanks! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: Thursday, October 08, 2009 1:45 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Export from SQL to Access http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlec ode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan _______________________________________________ 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 Fri Oct 9 11:36:26 2009 From: accessd at shaw.ca (Jim Lawrence) Date: Fri, 9 Oct 2009 09:36:26 -0700 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: <3CB806116449458895A7BCF04D65CEBF@danwaters> References: <200910081845.n98Ijl90008851@databaseadvisors.com> <3CB806116449458895A7BCF04D65CEBF@danwaters> Message-ID: Hi Dan: Have you tried your ODBC data source manager yet? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, October 08, 2009 1:53 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Rob, I tried to get this to connect to sqlexpress on my PC, but after an hour it's still not working. I'll try again later. Thanks! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: Thursday, October 08, 2009 1:45 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Export from SQL to Access http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlec ode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan _______________________________________________ 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 dwaters at usinternet.com Fri Oct 9 11:55:54 2009 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 9 Oct 2009 11:55:54 -0500 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: References: <200910081845.n98Ijl90008851@databaseadvisors.com><3CB806116449458895A7BCF04D65CEBF@danwaters> Message-ID: <089C94CF380F492F93572A13E86AB171@danwaters> Hi Jim, I've tried using the Database Connection Manager in Power Architect with these the parameters: Connection Name: Express DB Type: SQL Server 2005 Host Name: danwaters\sqlexpress Port: 1433 JDBC URL: jdbc:sqlserver://danwaters\sqlexpress:1433 I also enabled TCP/IP for SQL Server. The first line of the full error message is: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect How could I use the ODBC Data Source manager to make this connection? Thanks! Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Friday, October 09, 2009 11:36 AM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Dan: Have you tried your ODBC data source manager yet? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, October 08, 2009 1:53 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Rob, I tried to get this to connect to sqlexpress on my PC, but after an hour it's still not working. I'll try again later. Thanks! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: Thursday, October 08, 2009 1:45 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Export from SQL to Access http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlec ode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan _______________________________________________ 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 Fri Oct 9 12:21:08 2009 From: accessd at shaw.ca (Jim Lawrence) Date: Fri, 9 Oct 2009 10:21:08 -0700 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: <089C94CF380F492F93572A13E86AB171@danwaters> References: <200910081845.n98Ijl90008851@databaseadvisors.com> <3CB806116449458895A7BCF04D65CEBF@danwaters> <089C94CF380F492F93572A13E86AB171@danwaters> Message-ID: <55C064AB9DBD41EF911DBAC86FC79F68@creativesystemdesigns.com> Hi Dan: It sounds, from your description, that everything is local (on your PC), running (SQL Express is running). What I traditional do is: 1. Go to my desktop, right-mouse-click and create a new text file. 2. Rename the extension from txt to udl. 3. Then open the now new udl (ODBC) connection file and create a new connection and keep testing (test Connnection button) until a connection is made. 4. After the connection has been made I again rename the file exstention from udl to txt, open the newly created text file and then copy ands paste the connection string displayed in my application. If you are having some issues it may be because your SQL Express port (1433) is either been renumbered or blocked by your firewall. For further comments see the following link: http://www.teratrax.com/articles/connecting_sql_server_express.html HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Friday, October 09, 2009 9:56 AM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Jim, I've tried using the Database Connection Manager in Power Architect with these the parameters: Connection Name: Express DB Type: SQL Server 2005 Host Name: danwaters\sqlexpress Port: 1433 JDBC URL: jdbc:sqlserver://danwaters\sqlexpress:1433 I also enabled TCP/IP for SQL Server. The first line of the full error message is: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect How could I use the ODBC Data Source manager to make this connection? Thanks! Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Friday, October 09, 2009 11:36 AM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Dan: Have you tried your ODBC data source manager yet? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, October 08, 2009 1:53 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Rob, I tried to get this to connect to sqlexpress on my PC, but after an hour it's still not working. I'll try again later. Thanks! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: Thursday, October 08, 2009 1:45 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Export from SQL to Access http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlec ode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan _______________________________________________ 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 dwaters at usinternet.com Fri Oct 9 13:23:34 2009 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 9 Oct 2009 13:23:34 -0500 Subject: [dba-SQLServer] Export from SQL to Access In-Reply-To: <55C064AB9DBD41EF911DBAC86FC79F68@creativesystemdesigns.com> References: <200910081845.n98Ijl90008851@databaseadvisors.com><3CB806116449458895A7BCF04D65CEBF@danwaters><089C94CF380F492F93572A13E86AB171@danwaters> <55C064AB9DBD41EF911DBAC86FC79F68@creativesystemdesigns.com> Message-ID: <8A51D45628854C3EA7700B9890BF56E8@danwaters> Thanks Jim - I had forgotten about UDL. I connected first time with UDL, but Power Architect apparently uses some kind of JAVA connection method. I'll have to get help from the folks who made this program. Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Friday, October 09, 2009 12:21 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Dan: It sounds, from your description, that everything is local (on your PC), running (SQL Express is running). What I traditional do is: 1. Go to my desktop, right-mouse-click and create a new text file. 2. Rename the extension from txt to udl. 3. Then open the now new udl (ODBC) connection file and create a new connection and keep testing (test Connnection button) until a connection is made. 4. After the connection has been made I again rename the file exstention from udl to txt, open the newly created text file and then copy ands paste the connection string displayed in my application. If you are having some issues it may be because your SQL Express port (1433) is either been renumbered or blocked by your firewall. For further comments see the following link: http://www.teratrax.com/articles/connecting_sql_server_express.html HTH Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Friday, October 09, 2009 9:56 AM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Jim, I've tried using the Database Connection Manager in Power Architect with these the parameters: Connection Name: Express DB Type: SQL Server 2005 Host Name: danwaters\sqlexpress Port: 1433 JDBC URL: jdbc:sqlserver://danwaters\sqlexpress:1433 I also enabled TCP/IP for SQL Server. The first line of the full error message is: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect How could I use the ODBC Data Source manager to make this connection? Thanks! Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence Sent: Friday, October 09, 2009 11:36 AM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Dan: Have you tried your ODBC data source manager yet? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Thursday, October 08, 2009 1:53 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Export from SQL to Access Hi Rob, I tried to get this to connect to sqlexpress on my PC, but after an hour it's still not working. I'll try again later. Thanks! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert Stewart Sent: Thursday, October 08, 2009 1:45 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Export from SQL to Access http://www.sqlpower.ca/page/download?fileName=http://power-architect.googlec ode.com/files/Architect-Setup-Windows-jdbc-0.9.13.exe may work At 12:00 PM 10/8/2009, you wrote: >Date: Thu, 8 Oct 2009 07:08:10 -0500 >From: "Dan Waters" >Subject: [dba-SQLServer] Export from SQL to Access - Include Table > Relationships? >To: "'Discussion concerning MS SQL Server'" > >Message-ID: >Content-Type: text/plain; charset="us-ascii" > >Hello Everyone! > >I found out how to export data tables from SQL to Access using SSIS. >However, the table relationships did not come across. > >Is there a method in SQL or Access to quickly copy tables from SQL to Access >and include the table relationships? > >Thanks! >Dan _______________________________________________ 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 Wed Oct 14 08:03:27 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 14 Oct 2009 09:03:27 -0400 Subject: [dba-SQLServer] BCP error too generic Message-ID: <4AD5CC1F.4030606@colbyconsulting.com> I am getting a failure to import (BCP) some line in a file. When that happens the process just fails with an error "cannot fetch a row from OLE DB provider "BULK" for linked server "(null)" Is there any way to get the row number that triggered the failure? Or anything else even slightly more useful than this pretty darned useless error message? -- John W. Colby www.ColbyConsulting.com From mwp.reid at qub.ac.uk Wed Oct 14 08:10:59 2009 From: mwp.reid at qub.ac.uk (Martin Reid) Date: Wed, 14 Oct 2009 14:10:59 +0100 Subject: [dba-SQLServer] BCP error too generic In-Reply-To: <4AD5CC1F.4030606@colbyconsulting.com> References: <4AD5CC1F.4030606@colbyconsulting.com> Message-ID: <631CF83223105545BF43EFB52CB0829502AC4D9752@EX2K7-VIRT-2.ads.qub.ac.uk> http://blog.cybner.com.au/2007/09/cannot-fetch-row-from-ole-db-provider.html Martin WP Reid Information Services The Library at Queen's Tel : 02890976174 Email : mwp.reid at qub.ac.uk ________________________________________ From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby [jwcolby at colbyconsulting.com] Sent: 14 October 2009 14:03 To: Dba-Sqlserver Subject: [dba-SQLServer] BCP error too generic I am getting a failure to import (BCP) some line in a file. When that happens the process just fails with an error "cannot fetch a row from OLE DB provider "BULK" for linked server "(null)" Is there any way to get the row number that triggered the failure? Or anything else even slightly more useful than this pretty darned useless error message? -- John W. Colby 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 Oct 14 08:43:29 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 14 Oct 2009 09:43:29 -0400 Subject: [dba-SQLServer] BCP error too generic In-Reply-To: <631CF83223105545BF43EFB52CB0829502AC4D9752@EX2K7-VIRT-2.ads.qub.ac.uk> References: <4AD5CC1F.4030606@colbyconsulting.com> <631CF83223105545BF43EFB52CB0829502AC4D9752@EX2K7-VIRT-2.ads.qub.ac.uk> Message-ID: <4AD5D581.6000306@colbyconsulting.com> Yea, I saw this and about 47 million other posts for this error message. It appears that if ANYTHING (and I do mean ANYTHING) goes wrong in the import, BCP fails with this error message. The data I am trying to import is just full of trash. empty fields, rows without the correct number of fields etc. It is no wonder BCP complains. I was just hoping to get more info but it seems that is a dream. John W. Colby www.ColbyConsulting.com Martin Reid wrote: > http://blog.cybner.com.au/2007/09/cannot-fetch-row-from-ole-db-provider.html > > > > Martin WP Reid > Information Services > The Library at Queen's > Tel : 02890976174 > Email : mwp.reid at qub.ac.uk > ________________________________________ > From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby [jwcolby at colbyconsulting.com] > Sent: 14 October 2009 14:03 > To: Dba-Sqlserver > Subject: [dba-SQLServer] BCP error too generic > > I am getting a failure to import (BCP) some line in a file. When that happens the process just > fails with an error > > "cannot fetch a row from OLE DB provider "BULK" for linked server "(null)" > > Is there any way to get the row number that triggered the failure? Or anything else even slightly > more useful than this pretty darned useless error message? > > -- > John W. Colby > 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 robert at webedb.com Wed Oct 14 12:26:00 2009 From: robert at webedb.com (Robert Stewart) Date: Wed, 14 Oct 2009 12:26:00 -0500 Subject: [dba-SQLServer] BCP error too generic In-Reply-To: References: Message-ID: <200910141726.n9EHQKGn014296@databaseadvisors.com> BCP will only import clean, structured data. At 12:00 PM 10/14/2009, you wrote: >Date: Wed, 14 Oct 2009 09:43:29 -0400 >From: jwcolby >Subject: Re: [dba-SQLServer] BCP error too generic >To: Discussion concerning MS SQL Server > >Message-ID: <4AD5D581.6000306 at colbyconsulting.com> >Content-Type: text/plain; charset=ISO-8859-1; format=flowed > >Yea, I saw this and about 47 million other posts for this error >message. It appears that if >ANYTHING (and I do mean ANYTHING) goes wrong in the import, BCP >fails with this error message. The >data I am trying to import is just full of trash. empty fields, >rows without the correct number of >fields etc. It is no wonder BCP complains. > >I was just hoping to get more info but it seems that is a dream. > >John W. Colby From jwcolby at colbyconsulting.com Wed Oct 14 12:38:49 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 14 Oct 2009 13:38:49 -0400 Subject: [dba-SQLServer] BCP error too generic In-Reply-To: <200910141726.n9EHQKGn014296@databaseadvisors.com> References: <200910141726.n9EHQKGn014296@databaseadvisors.com> Message-ID: <4AD60CA9.3060808@colbyconsulting.com> Yea, so I see. John W. Colby www.ColbyConsulting.com Robert Stewart wrote: > BCP will only import clean, structured data. > > > At 12:00 PM 10/14/2009, you wrote: >> Date: Wed, 14 Oct 2009 09:43:29 -0400 >> From: jwcolby >> Subject: Re: [dba-SQLServer] BCP error too generic >> To: Discussion concerning MS SQL Server >> >> Message-ID: <4AD5D581.6000306 at colbyconsulting.com> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> >> Yea, I saw this and about 47 million other posts for this error >> message. It appears that if >> ANYTHING (and I do mean ANYTHING) goes wrong in the import, BCP >> fails with this error message. The >> data I am trying to import is just full of trash. empty fields, >> rows without the correct number of >> fields etc. It is no wonder BCP complains. >> >> I was just hoping to get more info but it seems that is a dream. >> >> John W. Colby > _______________________________________________ > 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 Wed Oct 14 14:21:18 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Thu, 15 Oct 2009 05:21:18 +1000 Subject: [dba-SQLServer] BCP error too generic In-Reply-To: <4AD5D581.6000306@colbyconsulting.com> References: <4AD5CC1F.4030606@colbyconsulting.com>, <631CF83223105545BF43EFB52CB0829502AC4D9752@EX2K7-VIRT-2.ads.qub.ac.uk>, <4AD5D581.6000306@colbyconsulting.com> Message-ID: <4AD624AE.27767.10E63D27@stuart.lexacorp.com.pg> If it's a delimited text file, I'd build my own pre-procesor to check and possibly clean up the file. Something to: Read in a line. SPLIT it into an array Check the number of fields using UBOUND Step through the fields validating as necessary. As a minimum, log the faulty line number and errors encountered. You could knock something up to to do this in Access in five minutes, If you want something to do it a lot faster for the big files in your database friom hell, send me a copy of your final Access procedure and I'll build a PBWin app for you to do the same thing in a fraction of the time. Cheers, Stuart On 14 Oct 2009 at 9:43, jwcolby wrote: > Yea, I saw this and about 47 million other posts for this error message. It appears that if > ANYTHING (and I do mean ANYTHING) goes wrong in the import, BCP fails with this error message. The > data I am trying to import is just full of trash. empty fields, rows without the correct number of > fields etc. It is no wonder BCP complains. > > I was just hoping to get more info but it seems that is a dream. > > John W. Colby > www.ColbyConsulting.com > > > Martin Reid wrote: > > http://blog.cybner.com.au/2007/09/cannot-fetch-row-from-ole-db-provider.html > > > > > > > > Martin WP Reid > > Information Services > > The Library at Queen's > > Tel : 02890976174 > > Email : mwp.reid at qub.ac.uk > > ________________________________________ > > From: dba-sqlserver-bounces at databaseadvisors.com [dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby [jwcolby at colbyconsulting.com] > > Sent: 14 October 2009 14:03 > > To: Dba-Sqlserver > > Subject: [dba-SQLServer] BCP error too generic > > > > I am getting a failure to import (BCP) some line in a file. When that happens the process just > > fails with an error > > > > "cannot fetch a row from OLE DB provider "BULK" for linked server "(null)" > > > > Is there any way to get the row number that triggered the failure? Or anything else even slightly > > more useful than this pretty darned useless error message? > > > > -- > > John W. Colby > > 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 Fri Oct 23 06:46:09 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 23 Oct 2009 07:46:09 -0400 Subject: [dba-SQLServer] process suspended Message-ID: <4AE19781.2090601@colbyconsulting.com> I have these stored procedures I run from Access, multi-step processes that import and export data from SQL Server. The code which executes these SPs run in Access running on the SQL server. I started an UPDATE process last night that I would have expected to complete by this morning but it is not complete. I found this thing called sp_who2 active which reports all active processes, very cool. The UPDATE process running on Azul, started by Microsoft Office 2003 (Access AFAICT) is status SUSPENDED. However if I click execute over and over for this sp_who2 thing it shows cpu activity and disk i/o going on this process. So what does suspended mean? Do I need to do something to unsuspend the process? Will it finish even though it is suspended? -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Wed Oct 28 11:31:50 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 28 Oct 2009 12:31:50 -0400 Subject: [dba-SQLServer] View not updatable because Message-ID: <4AE871F6.2060004@colbyconsulting.com> I have never figured out how to do the following... I have a table which contains records that I need to delete. I create a view that joins that table to another table on the PKID. The second table has a set of records which I need to delete out of the first table, then append into the first table. IOW the matching records in the first table have have been updated and I need to delete them, then append in the updated records. I get an error message: "view or function MyFunction is not updatable because the modification affects multiple base tables." This is a simple view witj two tables, joined on the PKID, all fields selected in the table that needs records updated (deleted), NO fields selected in the second table. What am I doing wrong? -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Wed Oct 28 11:38:30 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 28 Oct 2009 12:38:30 -0400 Subject: [dba-SQLServer] View not updatable because In-Reply-To: <4AE871F6.2060004@colbyconsulting.com> References: <4AE871F6.2060004@colbyconsulting.com> Message-ID: <4AE87386.8040700@colbyconsulting.com> What I have found on GOOGLE is that the FROM clause can only reference a single table. But if I am going to select records by a join, then by definition the where clause will reference more than one table. HELP!!! TIA. John W. Colby www.ColbyConsulting.com jwcolby wrote: > I have never figured out how to do the following... > > I have a table which contains records that I need to delete. I create a view that joins that table > to another table on the PKID. The second table has a set of records which I need to delete out of > the first table, then append into the first table. IOW the matching records in the first table have > have been updated and I need to delete them, then append in the updated records. > > I get an error message: > > "view or function MyFunction is not updatable because the modification affects multiple base tables." > > This is a simple view witj two tables, joined on the PKID, all fields selected in the table that > needs records updated (deleted), NO fields selected in the second table. > > What am I doing wrong? > From Betsy.Powlen at stanleyassociates.com Wed Oct 28 11:54:10 2009 From: Betsy.Powlen at stanleyassociates.com (Powlen, Betsy) Date: Wed, 28 Oct 2009 12:54:10 -0400 Subject: [dba-SQLServer] Audit table - How to capture user who deleted record Message-ID: <2A419A21A2A23243A9E7851EEDBDC1220179C47C@OP-S-EX-2.stanleyassociates.com> Hello everyone, I'm creating an audit table for our application. I had no problem with the trigger for an insert or update, but when a user deletes a record I can't figure out how to capture that user. I can't use system_user, that only shows the user name we created to access the application. Any ideas? Betsy Powlen Stanley Associates 3800 Fettler Park Drive Dumfries, VA 22025 Office: (703) 441-4965 Cell: (540) 498-0836 betsy.powlen.ctr at usmc.mil betsy.powlen at stanleyassociates.com From dwaters at usinternet.com Wed Oct 28 12:08:42 2009 From: dwaters at usinternet.com (Dan Waters) Date: Wed, 28 Oct 2009 12:08:42 -0500 Subject: [dba-SQLServer] Audit table - How to capture user who deleted record In-Reply-To: <2A419A21A2A23243A9E7851EEDBDC1220179C47C@OP-S-EX-2.stanleyassociates.com> References: <2A419A21A2A23243A9E7851EEDBDC1220179C47C@OP-S-EX-2.stanleyassociates.com> Message-ID: <339C2FFB9D164D7D84B8DFAE7A4E712C@danwaters> Hi Betsey, If people are logging in with a user name and password, then you can use 'CurrentUser'. This is an access function. Otherwise, you can get the PC Name that someone is using with this function: 'Environ("ComputerName")'. Good Luck! Dan` -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Powlen, Betsy Sent: Wednesday, October 28, 2009 11:54 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Audit table - How to capture user who deleted record Hello everyone, I'm creating an audit table for our application. I had no problem with the trigger for an insert or update, but when a user deletes a record I can't figure out how to capture that user. I can't use system_user, that only shows the user name we created to access the application. Any ideas? Betsy Powlen Stanley Associates 3800 Fettler Park Drive Dumfries, VA 22025 Office: (703) 441-4965 Cell: (540) 498-0836 betsy.powlen.ctr at usmc.mil betsy.powlen at stanleyassociates.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Betsy.Powlen at stanleyassociates.com Wed Oct 28 12:36:42 2009 From: Betsy.Powlen at stanleyassociates.com (Powlen, Betsy) Date: Wed, 28 Oct 2009 13:36:42 -0400 Subject: [dba-SQLServer] Audit table - How to capture user who deletedrecord In-Reply-To: <339C2FFB9D164D7D84B8DFAE7A4E712C@danwaters> Message-ID: <2A419A21A2A23243A9E7851EEDBDC1220179C47D@OP-S-EX-2.stanleyassociates.com> Thanks, Dan. The problem is, people aren't directly users on the database. The actual user data is on another database and they go through a bunch of security hoops to get to the main application. From there, there is a link to our application. Normally, whenever we need a user name, we use a parameter, but apparently that doesn't work with triggers. The only way I can think off hand is to update the table with the session id first, but was wondering if that is too big of a strain on the system as we will be implementing this on all our editable tables. Thoughts? Betsy Powlen Stanley Associates 3800 Fettler Park Drive Dumfries, VA 22025 Office: (703) 441-4965 Cell: (540) 498-0836 betsy.powlen.ctr at usmc.mil betsy.powlen at stanleyassociates.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Wednesday, October 28, 2009 1:09 PM To: 'Discussion concerning MS SQL Server' Subject: Re: [dba-SQLServer] Audit table - How to capture user who deletedrecord Hi Betsey, If people are logging in with a user name and password, then you can use 'CurrentUser'. This is an access function. Otherwise, you can get the PC Name that someone is using with this function: 'Environ("ComputerName")'. Good Luck! Dan` -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Powlen, Betsy Sent: Wednesday, October 28, 2009 11:54 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Audit table - How to capture user who deleted record Hello everyone, I'm creating an audit table for our application. I had no problem with the trigger for an insert or update, but when a user deletes a record I can't figure out how to capture that user. I can't use system_user, that only shows the user name we created to access the application. Any ideas? Betsy Powlen Stanley Associates 3800 Fettler Park Drive Dumfries, VA 22025 Office: (703) 441-4965 Cell: (540) 498-0836 betsy.powlen.ctr at usmc.mil betsy.powlen at stanleyassociates.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 davidmcafee at gmail.com Wed Oct 28 12:49:52 2009 From: davidmcafee at gmail.com (David McAfee) Date: Wed, 28 Oct 2009 10:49:52 -0700 Subject: [dba-SQLServer] Audit table - How to capture user who deletedrecord In-Reply-To: <2A419A21A2A23243A9E7851EEDBDC1220179C47D@OP-S-EX-2.stanleyassociates.com> References: <339C2FFB9D164D7D84B8DFAE7A4E712C@danwaters> <2A419A21A2A23243A9E7851EEDBDC1220179C47D@OP-S-EX-2.stanleyassociates.com> Message-ID: <8786a4c00910281049t1cc490e6s36fa9f92e1ecc840@mail.gmail.com> How do you mark edits or insertions? One thing to do is never to allow deletions. Instead mark a record as "deleted" and filter it from views. On Wed, Oct 28, 2009 at 10:36 AM, Powlen, Betsy wrote: > Thanks, Dan. The problem is, people aren't directly users on the > database. The actual user data is on another database and they go > through a bunch of security hoops to get to the main application. From > there, there is a link to our application. ? Normally, whenever we need > a user name, we use a parameter, but apparently that doesn't work with > triggers. The only way I can think off hand is to update the table with > the session id first, but was wondering if that is too big of a strain > on the system as we will be implementing this on all our editable > tables. > Thoughts? > > > Betsy Powlen > Stanley Associates > 3800 Fettler Park Drive > Dumfries, VA ?22025 > Office: (703) 441-4965 > Cell: ? ?(540) 498-0836 > betsy.powlen.ctr at usmc.mil > betsy.powlen at stanleyassociates.com > > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan > Waters > Sent: Wednesday, October 28, 2009 1:09 PM > To: 'Discussion concerning MS SQL Server' > Subject: Re: [dba-SQLServer] Audit table - How to capture user who > deletedrecord > > Hi Betsey, > > If people are logging in with a user name and password, then you can use > 'CurrentUser'. ?This is an access function. > > Otherwise, you can get the PC Name that someone is using with this > function: > 'Environ("ComputerName")'. > > Good Luck! > Dan` > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Powlen, > Betsy > Sent: Wednesday, October 28, 2009 11:54 AM > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer] Audit table - How to capture user who deleted > record > > Hello everyone, > I'm creating an audit table for our application. I had no problem with > the trigger for an insert or update, but when a user deletes a record I > can't figure out how to capture that user. > I can't use system_user, that only shows the user name we created to > access the application. > Any ideas? > > Betsy Powlen > Stanley Associates > 3800 Fettler Park Drive > Dumfries, VA ?22025 > Office: (703) 441-4965 > Cell: ? ?(540) 498-0836 > betsy.powlen.ctr at usmc.mil > betsy.powlen at stanleyassociates.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 Betsy.Powlen at stanleyassociates.com Wed Oct 28 14:08:06 2009 From: Betsy.Powlen at stanleyassociates.com (Powlen, Betsy) Date: Wed, 28 Oct 2009 15:08:06 -0400 Subject: [dba-SQLServer] Audit table - How to capture user whodeletedrecord In-Reply-To: <8786a4c00910281049t1cc490e6s36fa9f92e1ecc840@mail.gmail.com> Message-ID: <2A419A21A2A23243A9E7851EEDBDC1220179C47E@OP-S-EX-2.stanleyassociates.com> We don't mark anything. We want to use a trigger to populate the history table using the virtual INSERTED and DELETED tables. Works great for inserts and updates, but modified_by doesn't get tracked anywhere on a delete. On an insert or update it gets tracked in the INSERTED table. I don't have any issue with records being deleted in that table, I just need to keep track of who does what. We're going to try a workaround using the SPID that's in our LoginTrack table. Hoping that will give us what we need. Thanks for all your ideas! Betsy -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: Wednesday, October 28, 2009 1:50 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Audit table - How to capture user whodeletedrecord How do you mark edits or insertions? One thing to do is never to allow deletions. Instead mark a record as "deleted" and filter it from views. On Wed, Oct 28, 2009 at 10:36 AM, Powlen, Betsy wrote: > Thanks, Dan. The problem is, people aren't directly users on the > database. The actual user data is on another database and they go > through a bunch of security hoops to get to the main application. From > there, there is a link to our application. ? Normally, whenever we > need a user name, we use a parameter, but apparently that doesn't work > with triggers. The only way I can think off hand is to update the > table with the session id first, but was wondering if that is too big > of a strain on the system as we will be implementing this on all our > editable tables. > Thoughts? > > > Betsy Powlen > Stanley Associates > 3800 Fettler Park Drive > Dumfries, VA ?22025 > Office: (703) 441-4965 > Cell: ? ?(540) 498-0836 > betsy.powlen.ctr at usmc.mil > betsy.powlen at stanleyassociates.com > > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan > Waters > Sent: Wednesday, October 28, 2009 1:09 PM > To: 'Discussion concerning MS SQL Server' > Subject: Re: [dba-SQLServer] Audit table - How to capture user who > deletedrecord > > Hi Betsey, > > If people are logging in with a user name and password, then you can > use 'CurrentUser'. ?This is an access function. > > Otherwise, you can get the PC Name that someone is using with this > function: > 'Environ("ComputerName")'. > > Good Luck! > Dan` > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > Powlen, Betsy > Sent: Wednesday, October 28, 2009 11:54 AM > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer] Audit table - How to capture user who deleted > record > > Hello everyone, > I'm creating an audit table for our application. I had no problem with > the trigger for an insert or update, but when a user deletes a record > I can't figure out how to capture that user. > I can't use system_user, that only shows the user name we created to > access the application. > Any ideas? > > Betsy Powlen > Stanley Associates > 3800 Fettler Park Drive > Dumfries, VA ?22025 > Office: (703) 441-4965 > Cell: ? ?(540) 498-0836 > betsy.powlen.ctr at usmc.mil > betsy.powlen at stanleyassociates.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 fhtapia at gmail.com Wed Oct 28 14:54:17 2009 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 28 Oct 2009 12:54:17 -0700 Subject: [dba-SQLServer] View not updatable because In-Reply-To: <4AE87386.8040700@colbyconsulting.com> References: <4AE871F6.2060004@colbyconsulting.com> <4AE87386.8040700@colbyconsulting.com> Message-ID: I think you want to write up your statement as a delete statement, not adelete from view but a delete from a table does that make sense? The result is that you'd use a sproc (stored procedure) to help delte records and not a standard statement. Sent from my mobile On Oct 28, 2009, at 9:38 AM, jwcolby wrote: > What I have found on GOOGLE is that the FROM clause can only > reference a single table. But if I am > going to select records by a join, then by definition the where > clause will reference more than one > table. > > HELP!!! > > TIA. > > John W. Colby > www.ColbyConsulting.com > > > jwcolby wrote: >> I have never figured out how to do the following... >> >> I have a table which contains records that I need to delete. I >> create a view that joins that table >> to another table on the PKID. The second table has a set of >> records which I need to delete out of >> the first table, then append into the first table. IOW the >> matching records in the first table have >> have been updated and I need to delete them, then append in the >> updated records. >> >> I get an error message: >> >> "view or function MyFunction is not updatable because the >> modification affects multiple base tables." >> >> This is a simple view witj two tables, joined on the PKID, all >> fields selected in the table that >> needs records updated (deleted), NO fields selected in the second >> table. >> >> What am I doing wrong? >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From Elizabeth.J.Doering at wellsfargo.com Wed Oct 28 15:10:47 2009 From: Elizabeth.J.Doering at wellsfargo.com (Elizabeth.J.Doering at wellsfargo.com) Date: Wed, 28 Oct 2009 15:10:47 -0500 Subject: [dba-SQLServer] View not updatable because In-Reply-To: References: <4AE871F6.2060004@colbyconsulting.com> <4AE87386.8040700@colbyconsulting.com> Message-ID: <4838EC790FF778449985FC3B8A47F8714485F86F00@MSGCMSV21011.ent.wfb.bank.corp> Try something like this: Delete from MyTable1 where PK in (select PK from MyTable2) Not as quick as you will like. But it will do what you want. HTH, Liz This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia Sent: Wednesday, October 28, 2009 2:54 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] View not updatable because I think you want to write up your statement as a delete statement, not adelete from view but a delete from a table does that make sense? The result is that you'd use a sproc (stored procedure) to help delte records and not a standard statement. Sent from my mobile On Oct 28, 2009, at 9:38 AM, jwcolby wrote: > What I have found on GOOGLE is that the FROM clause can only > reference a single table. But if I am > going to select records by a join, then by definition the where > clause will reference more than one > table. > > HELP!!! > > TIA. > > John W. Colby > www.ColbyConsulting.com > > > jwcolby wrote: >> I have never figured out how to do the following... >> >> I have a table which contains records that I need to delete. I >> create a view that joins that table >> to another table on the PKID. The second table has a set of >> records which I need to delete out of >> the first table, then append into the first table. IOW the >> matching records in the first table have >> have been updated and I need to delete them, then append in the >> updated records. >> >> I get an error message: >> >> "view or function MyFunction is not updatable because the >> modification affects multiple base tables." >> >> This is a simple view witj two tables, joined on the PKID, all >> fields selected in the table that >> needs records updated (deleted), NO fields selected in the second >> table. >> >> What am I doing wrong? >> > _______________________________________________ > 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 Wed Oct 28 15:18:08 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 28 Oct 2009 16:18:08 -0400 Subject: [dba-SQLServer] View not updatable because In-Reply-To: <4838EC790FF778449985FC3B8A47F8714485F86F00@MSGCMSV21011.ent.wfb.bank.corp> References: <4AE871F6.2060004@colbyconsulting.com> <4AE87386.8040700@colbyconsulting.com> <4838EC790FF778449985FC3B8A47F8714485F86F00@MSGCMSV21011.ent.wfb.bank.corp> Message-ID: <4AE8A700.6090903@colbyconsulting.com> Thanks Liz. John W. Colby www.ColbyConsulting.com Elizabeth.J.Doering at wellsfargo.com wrote: > Try something like this: > > Delete from MyTable1 where PK in (select PK from MyTable2) > > Not as quick as you will like. But it will do what you want. > > HTH, > > Liz > > > > This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. > > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia > Sent: Wednesday, October 28, 2009 2:54 PM > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] View not updatable because > > I think you want to write up your statement as a delete statement, not > adelete from view but a delete from a table does that make sense? > The result is that you'd use a sproc (stored procedure) to help delte > records and not a standard statement. > > Sent from my mobile > > On Oct 28, 2009, at 9:38 AM, jwcolby > wrote: > >> What I have found on GOOGLE is that the FROM clause can only >> reference a single table. But if I am >> going to select records by a join, then by definition the where >> clause will reference more than one >> table. >> >> HELP!!! >> >> TIA. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> jwcolby wrote: >>> I have never figured out how to do the following... >>> >>> I have a table which contains records that I need to delete. I >>> create a view that joins that table >>> to another table on the PKID. The second table has a set of >>> records which I need to delete out of >>> the first table, then append into the first table. IOW the >>> matching records in the first table have >>> have been updated and I need to delete them, then append in the >>> updated records. >>> >>> I get an error message: >>> >>> "view or function MyFunction is not updatable because the >>> modification affects multiple base tables." >>> >>> This is a simple view witj two tables, joined on the PKID, all >>> fields selected in the table that >>> needs records updated (deleted), NO fields selected in the second >>> table. >>> >>> What am I doing wrong? >>> >> _______________________________________________ >> 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 Wed Oct 28 15:25:34 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 28 Oct 2009 16:25:34 -0400 Subject: [dba-SQLServer] View not updatable because In-Reply-To: <4838EC790FF778449985FC3B8A47F8714485F86F00@MSGCMSV21011.ent.wfb.bank.corp> References: <4AE871F6.2060004@colbyconsulting.com> <4AE87386.8040700@colbyconsulting.com> <4838EC790FF778449985FC3B8A47F8714485F86F00@MSGCMSV21011.ent.wfb.bank.corp> Message-ID: <4AE8A8BE.5080105@colbyconsulting.com> > Not as quick as you will like. But it will do what you want. Actually that was BLAZING fast! Seven seconds to delete a million rows. John W. Colby www.ColbyConsulting.com Elizabeth.J.Doering at wellsfargo.com wrote: > Try something like this: > > Delete from MyTable1 where PK in (select PK from MyTable2) > > Not as quick as you will like. But it will do what you want. > > HTH, > > Liz > > > > This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. > > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia > Sent: Wednesday, October 28, 2009 2:54 PM > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] View not updatable because > > I think you want to write up your statement as a delete statement, not > adelete from view but a delete from a table does that make sense? > The result is that you'd use a sproc (stored procedure) to help delte > records and not a standard statement. > > Sent from my mobile > > On Oct 28, 2009, at 9:38 AM, jwcolby > wrote: > >> What I have found on GOOGLE is that the FROM clause can only >> reference a single table. But if I am >> going to select records by a join, then by definition the where >> clause will reference more than one >> table. >> >> HELP!!! >> >> TIA. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> jwcolby wrote: >>> I have never figured out how to do the following... >>> >>> I have a table which contains records that I need to delete. I >>> create a view that joins that table >>> to another table on the PKID. The second table has a set of >>> records which I need to delete out of >>> the first table, then append into the first table. IOW the >>> matching records in the first table have >>> have been updated and I need to delete them, then append in the >>> updated records. >>> >>> I get an error message: >>> >>> "view or function MyFunction is not updatable because the >>> modification affects multiple base tables." >>> >>> This is a simple view witj two tables, joined on the PKID, all >>> fields selected in the table that >>> needs records updated (deleted), NO fields selected in the second >>> table. >>> >>> What am I doing wrong? >>> >> _______________________________________________ >> 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 Fri Oct 30 14:40:37 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 30 Oct 2009 15:40:37 -0400 Subject: [dba-SQLServer] How does a clustered index really work Message-ID: <4AEB4135.20107@colbyconsulting.com> I need more information about how a clustered index really works. I work with some fairly large tables, in this specific case 67 million records. The table has a PKID (Identity) as well as a PK from another table (foreign key). It then has name / address fields, plus about 8 non name / address fields. I have come to the conclusion that I need to update this table about once a month or so (address validation stuff). The updates will affect a smallish subset of the total records, perhaps a million or so records, maybe less (about 2% of the total records, once a month). I have read that using a clustered index speeds up any operations that pull data ONLY from fields in the clustered index because of the way the data is stored on disk. My understanding is that those fields are stored contiguously, whereas other indexed fields are stored in leaf nodes in a b-tree. I understand a b-tree, though the knowledge is old. Because of some of the processes I run I am wondering whether I should take the hit of placing the PK/FK fields plus the name / address fields in a clustered index. I use just those fields a LOT. There are some additional fields that I use sporadically. Other than the PK/FK and NAME fields, all the other fields may be updated, though as I mentioned, rarely more than about 2% of the total records. My understanding is that IF the changes in the data in the clustered index cause the ORDER of the data to change, then the updates to those fields would be slow, but if the order never changes then clustered index field updates aren't particularly slow. Am I right so far? Because the first field in the clustered index would be the Identity field, the ORDER of the records will NEVER change. Thus my read is that I can safely store any of the other fields I want without worrying about causing that particular performance hit on updates. Question, because of the storage method on disk, are the updates to clustered index fields FASTER than they would be otherwise, IOW getting at the data is faster, the order doesn't change so the update proceeds faster? I am a SQL Server wannabe. I use it a LOT but at the same time I never see myself becoming an expert, never mind a guru. Is there something I can read about this subject that addresses my level, that I could fairly easily get my questions about this answered? TIA for your patient responses. ;) -- John W. Colby www.ColbyConsulting.com From jlawrenc1 at shaw.ca Sat Oct 31 04:48:19 2009 From: jlawrenc1 at shaw.ca (Jim Lawrence) Date: Sat, 31 Oct 2009 02:48:19 -0700 Subject: [dba-SQLServer] How does a clustered index really work In-Reply-To: <4AEB4135.20107@colbyconsulting.com> References: <4AEB4135.20107@colbyconsulting.com> Message-ID: <26DCFC3DF79C44CBAF26EEC8AD4C772A@creativesystemdesigns.com> Hi John: This explanation works for me: http://weblogs.sqlteam.com/mladenp/archive/2007/09/18/Back-To-Basics-What-is -a-Clustered-and-a-Non-Clustered.aspx Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, October 30, 2009 12:41 PM To: Dba-Sqlserver Subject: [dba-SQLServer] How does a clustered index really work I need more information about how a clustered index really works. I work with some fairly large tables, in this specific case 67 million records. The table has a PKID (Identity) as well as a PK from another table (foreign key). It then has name / address fields, plus about 8 non name / address fields. I have come to the conclusion that I need to update this table about once a month or so (address validation stuff). The updates will affect a smallish subset of the total records, perhaps a million or so records, maybe less (about 2% of the total records, once a month). I have read that using a clustered index speeds up any operations that pull data ONLY from fields in the clustered index because of the way the data is stored on disk. My understanding is that those fields are stored contiguously, whereas other indexed fields are stored in leaf nodes in a b-tree. I understand a b-tree, though the knowledge is old. Because of some of the processes I run I am wondering whether I should take the hit of placing the PK/FK fields plus the name / address fields in a clustered index. I use just those fields a LOT. There are some additional fields that I use sporadically. Other than the PK/FK and NAME fields, all the other fields may be updated, though as I mentioned, rarely more than about 2% of the total records. My understanding is that IF the changes in the data in the clustered index cause the ORDER of the data to change, then the updates to those fields would be slow, but if the order never changes then clustered index field updates aren't particularly slow. Am I right so far? Because the first field in the clustered index would be the Identity field, the ORDER of the records will NEVER change. Thus my read is that I can safely store any of the other fields I want without worrying about causing that particular performance hit on updates. Question, because of the storage method on disk, are the updates to clustered index fields FASTER than they would be otherwise, IOW getting at the data is faster, the order doesn't change so the update proceeds faster? I am a SQL Server wannabe. I use it a LOT but at the same time I never see myself becoming an expert, never mind a guru. Is there something I can read about this subject that addresses my level, that I could fairly easily get my questions about this answered? TIA for your patient responses. ;) -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com