From jwcolby at colbyconsulting.com Sat Jul 4 07:40:53 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 08:40:53 -0400 Subject: [dba-SQLServer] Is there a better way Message-ID: <4A4F4DD5.4000508@colbyconsulting.com> I am updating a flag field which tells me that an address is valid. The code currently consists of a series of about FIVE passes through the table doing things like: Update MyTbl SET AddrValid = 'ANK' WHERE ANK_ IS NOT NULL Update MyTbl SET AddrValid = 'PO' WHERE (AddrValid IS NULL) AND (Addr Like 'PO%') Update MyTbl SET AddrValid = 'MOV' WHERE (AddrValid IS NULL) AND (Addr Like 'MOVED%') Etc next code Etc Next code My objective is to have a moved flag that I can find all of my ANK records, or EXCLUDE the ANK and Moved etc. Obviously I have a ton of processing going on here. It has to do N passes through the table to find and create N different codes. With tens of millions of records this is taking a large while. Is there a faster way? Drop the where and put the where processing into a UDF that figures out what the code should be. So every record gets processed, and the UDF takes the fields in the where clause and decides what code to assign. Something like that. Would it be faster? Given that we are by design visiting every row I would think it would be, though it might be a complex function to design. -- John W. Colby www.ColbyConsulting.com From jwcolby at colbyconsulting.com Sat Jul 4 08:35:56 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 09:35:56 -0400 Subject: [dba-SQLServer] Testing UDFs Message-ID: <4A4F5ABC.7010108@colbyconsulting.com> I am jumping into writing UDFs this morning. I need to test the results. When I write a query to pull data from a table using the UDF as one of the columns (just to display what happens) I get: "uf_AddrValid not a recognized built-in function name." Is there a naming convention to allow SQL Server (2005) to understand my UDF and use them? I know that there was a prefix I had to use in stored procedures. -- John W. Colby www.ColbyConsulting.com From mikedorism at verizon.net Sat Jul 4 08:36:37 2009 From: mikedorism at verizon.net (Doris Manning) Date: Sat, 04 Jul 2009 09:36:37 -0400 Subject: [dba-SQLServer] Is there a better way In-Reply-To: <4A4F4DD5.4000508@colbyconsulting.com> References: <4A4F4DD5.4000508@colbyconsulting.com> Message-ID: <9F9DD96FC6A947248A2177225002B01C@Kermit> Take a look at CASE WHEN in the BOL. 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: Saturday, July 04, 2009 8:41 AM To: Dba-Sqlserver Subject: [dba-SQLServer] Is there a better way I am updating a flag field which tells me that an address is valid. The code currently consists of a series of about FIVE passes through the table doing things like: Update MyTbl SET AddrValid = 'ANK' WHERE ANK_ IS NOT NULL Update MyTbl SET AddrValid = 'PO' WHERE (AddrValid IS NULL) AND (Addr Like 'PO%') Update MyTbl SET AddrValid = 'MOV' WHERE (AddrValid IS NULL) AND (Addr Like 'MOVED%') Etc next code Etc Next code My objective is to have a moved flag that I can find all of my ANK records, or EXCLUDE the ANK and Moved etc. Obviously I have a ton of processing going on here. It has to do N passes through the table to find and create N different codes. With tens of millions of records this is taking a large while. Is there a faster way? Drop the where and put the where processing into a UDF that figures out what the code should be. So every record gets processed, and the UDF takes the fields in the where clause and decides what code to assign. Something like that. Would it be faster? Given that we are by design visiting every row I would think it would be, though it might be a complex function to design. -- 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 mikedorism at verizon.net Sat Jul 4 08:39:41 2009 From: mikedorism at verizon.net (Doris Manning) Date: Sat, 04 Jul 2009 09:39:41 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4F5ABC.7010108@colbyconsulting.com> References: <4A4F5ABC.7010108@colbyconsulting.com> Message-ID: <46AA6A01EEF7441290045D1B6801A8EB@Kermit> Dbo.uf_AddrValid -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Saturday, July 04, 2009 9:36 AM To: Dba-Sqlserver Subject: [dba-SQLServer] Testing UDFs I am jumping into writing UDFs this morning. I need to test the results. When I write a query to pull data from a table using the UDF as one of the columns (just to display what happens) I get: "uf_AddrValid not a recognized built-in function name." Is there a naming convention to allow SQL Server (2005) to understand my UDF and use them? I know that there was a prefix I had to use in stored procedures. -- 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 Sat Jul 4 08:42:35 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 09:42:35 -0400 Subject: [dba-SQLServer] SPAM-LOW: Re: Is there a better way In-Reply-To: <9F9DD96FC6A947248A2177225002B01C@Kermit> References: <4A4F4DD5.4000508@colbyconsulting.com> <9F9DD96FC6A947248A2177225002B01C@Kermit> Message-ID: <4A4F5C4B.8050205@colbyconsulting.com> Doris, Thanks for the response but the tests have to be over several different fields. I will use If Else. this is the first UDF I have written and of course I am up against the learning curve. ATM I need to figure out how to get a test query running. When I try to add the UDF as a field of the query it gives me an error "not a recognized function". I assume that perhaps I have to have some prefix in my UDF similar to the sp_ required for stored procedures? I haven't found it yet on Google. John W. Colby www.ColbyConsulting.com Doris Manning wrote: > Take a look at CASE WHEN in the BOL. > > 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: Saturday, July 04, 2009 8:41 AM > To: Dba-Sqlserver > Subject: [dba-SQLServer] Is there a better way > > I am updating a flag field which tells me that an address is valid. The > code currently consists of a series of about FIVE passes through the table > doing things like: > > Update MyTbl > SET AddrValid = 'ANK' > WHERE ANK_ IS NOT NULL > > Update MyTbl > SET AddrValid = 'PO' > WHERE (AddrValid IS NULL) AND (Addr Like 'PO%') > > > Update MyTbl > SET AddrValid = 'MOV' > WHERE (AddrValid IS NULL) AND (Addr Like 'MOVED%') > > Etc next code > > Etc Next code > > My objective is to have a moved flag that I can find all of my ANK records, > or EXCLUDE the ANK and Moved etc. > > Obviously I have a ton of processing going on here. It has to do N passes > through the table to find and create N different codes. With tens of > millions of records this is taking a large while. > > Is there a faster way? Drop the where and put the where processing into a > UDF that figures out what the code should be. So every record gets > processed, and the UDF takes the fields in the where clause and decides what > code to assign. > > Something like that. Would it be faster? Given that we are by design > visiting every row I would think it would be, though it might be a complex > function to design. > > > From jwcolby at colbyconsulting.com Sat Jul 4 08:57:08 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 09:57:08 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <46AA6A01EEF7441290045D1B6801A8EB@Kermit> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> Message-ID: <4A4F5FB4.3040403@colbyconsulting.com> That isn't getting it. SELECT Top (100) percent ank_, Addr, udf_AddrValid(ank_,Addr) as Expr1 From dbo.TblAZData Where... Order By ... Whether I throw a dbo. in there or not I get an error that udf_AddrValid is not a builtin function name. John W. Colby www.ColbyConsulting.com Doris Manning wrote: > Dbo.uf_AddrValid > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Saturday, July 04, 2009 9:36 AM > To: Dba-Sqlserver > Subject: [dba-SQLServer] Testing UDFs > > I am jumping into writing UDFs this morning. I need to test the results. > When I write a query to pull data from a table using the UDF as one of the > columns (just to display what happens) I get: > > "uf_AddrValid not a recognized built-in function name." > > Is there a naming convention to allow SQL Server (2005) to understand my UDF > and use them? I know that there was a prefix I had to use in stored > procedures. > > -- > 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 Sat Jul 4 08:57:58 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 09:57:58 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <46AA6A01EEF7441290045D1B6801A8EB@Kermit> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> Message-ID: <4A4F5FE6.1010806@colbyconsulting.com> BTW I designed the UDF in the Master database in the hopes that it would be visible from any other database when it was time to do an update query. John W. Colby www.ColbyConsulting.com Doris Manning wrote: > Dbo.uf_AddrValid > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Saturday, July 04, 2009 9:36 AM > To: Dba-Sqlserver > Subject: [dba-SQLServer] Testing UDFs > > I am jumping into writing UDFs this morning. I need to test the results. > When I write a query to pull data from a table using the UDF as one of the > columns (just to display what happens) I get: > > "uf_AddrValid not a recognized built-in function name." > > Is there a naming convention to allow SQL Server (2005) to understand my UDF > and use them? I know that there was a prefix I had to use in stored > procedures. > > -- > 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 Sat Jul 4 09:01:21 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 10:01:21 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4F5FE6.1010806@colbyconsulting.com> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> Message-ID: <4A4F60B1.4090908@colbyconsulting.com> Well... I put master.dbo.MyUDFName and it worked just fine. John W. Colby www.ColbyConsulting.com jwcolby wrote: > BTW I designed the UDF in the Master database in the hopes that it would be visible from any other > database when it was time to do an update query. > > John W. Colby > www.ColbyConsulting.com > > > Doris Manning wrote: >> Dbo.uf_AddrValid >> >> -----Original Message----- >> From: dba-sqlserver-bounces at databaseadvisors.com >> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby >> Sent: Saturday, July 04, 2009 9:36 AM >> To: Dba-Sqlserver >> Subject: [dba-SQLServer] Testing UDFs >> >> I am jumping into writing UDFs this morning. I need to test the results. >> When I write a query to pull data from a table using the UDF as one of the >> columns (just to display what happens) I get: >> >> "uf_AddrValid not a recognized built-in function name." >> >> Is there a naming convention to allow SQL Server (2005) to understand my UDF >> and use them? I know that there was a prefix I had to use in stored >> procedures. >> >> -- >> 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 stuart at lexacorp.com.pg Sat Jul 4 09:08:09 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 05 Jul 2009 00:08:09 +1000 Subject: [dba-SQLServer] Is there a better way In-Reply-To: <4A4F4DD5.4000508@colbyconsulting.com> References: <4A4F4DD5.4000508@colbyconsulting.com> Message-ID: <4A4F6249.14029.D996FC9@stuart.lexacorp.com.pg> Can't you use something like: Update MyTbl Set AddrValid = (CASE WHEN (ANK IS NOT NULL THEN 'ANK' CASE WHEN (AddrValid IS NULL) AND (Addr Like 'PO%') THEN 'PO' CASE WHEN (AddrValid IS NULL) AND (Addr Like 'MOVED%') THEN 'MOV' CASE WHEN (AddrValid IS NULL) AND (Addr Like '.........%') THEN '...' ) -- Stuart On 4 Jul 2009 at 8:40, jwcolby wrote: > I am updating a flag field which tells me that an address is valid. The code currently consists of > a series of about FIVE passes through the table doing things like: > > Update MyTbl > SET AddrValid = 'ANK' > WHERE ANK_ IS NOT NULL > > Update MyTbl > SET AddrValid = 'PO' > WHERE (AddrValid IS NULL) AND (Addr Like 'PO%') > > > Update MyTbl > SET AddrValid = 'MOV' > WHERE (AddrValid IS NULL) AND (Addr Like 'MOVED%') > > Etc next code > > Etc Next code > > My objective is to have a moved flag that I can find all of my ANK records, or EXCLUDE the ANK and > Moved etc. > > Obviously I have a ton of processing going on here. It has to do N passes through the table to find > and create N different codes. With tens of millions of records this is taking a large while. > > Is there a faster way? Drop the where and put the where processing into a UDF that figures out what > the code should be. So every record gets processed, and the UDF takes the fields in the where > clause and decides what code to assign. > > Something like that. Would it be faster? Given that we are by design visiting every row I would > think it would be, though it might be a complex function to design. > > > > -- > 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 Sat Jul 4 09:22:34 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 10:22:34 -0400 Subject: [dba-SQLServer] SPAM-LOW: Re: Is there a better way In-Reply-To: <4A4F6249.14029.D996FC9@stuart.lexacorp.com.pg> References: <4A4F4DD5.4000508@colbyconsulting.com> <4A4F6249.14029.D996FC9@stuart.lexacorp.com.pg> Message-ID: <4A4F65AA.6070009@colbyconsulting.com> Yes, I guess so. Thanks for that suggestion, it is much simpler. Does the next case only execute if the first case fails? Or does the (addrValid is null) pick up the fact that previous cases set AddrValid? This syntax is nothing like VBA and so I am completely in the dark as to how to use it. John W. Colby www.ColbyConsulting.com Stuart McLachlan wrote: > Can't you use something like: > > Update MyTbl > Set AddrValid = > (CASE WHEN (ANK IS NOT NULL THEN 'ANK' > CASE WHEN (AddrValid IS NULL) AND (Addr Like 'PO%') THEN 'PO' > CASE WHEN (AddrValid IS NULL) AND (Addr Like 'MOVED%') THEN 'MOV' > CASE WHEN (AddrValid IS NULL) AND (Addr Like '.........%') THEN '...' > ) > From stuart at lexacorp.com.pg Sat Jul 4 09:33:28 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 05 Jul 2009 00:33:28 +1000 Subject: [dba-SQLServer] SPAM-LOW: Re: Is there a better way In-Reply-To: <4A4F65AA.6070009@colbyconsulting.com> References: <4A4F4DD5.4000508@colbyconsulting.com>, <4A4F6249.14029.D996FC9@stuart.lexacorp.com.pg>, <4A4F65AA.6070009@colbyconsulting.com> Message-ID: <4A4F6838.874.DB09CE2@stuart.lexacorp.com.pg> OK, that was very quick air code with lots of bugs. This one is tested and actually works: Update MyTbl Set AddrValid = (CASE WHEN (ANK IS NOT NULL) THEN 'ANK' WHEN (AddrValid IS NULL) AND (Addr Like 'PO%') THEN 'PO' WHEN (AddrValid IS NULL) AND (Addr Like 'MOVED%') THEN 'MOV' END) It works like a VBA "Select Case" in that once a condition is met, it drops straight through to the END -- Stuart On 4 Jul 2009 at 10:22, jwcolby wrote: > Yes, I guess so. Thanks for that suggestion, it is much simpler. Does the next case only execute > if the first case fails? Or does the (addrValid is null) pick up the fact that previous cases set > AddrValid? > > This syntax is nothing like VBA and so I am completely in the dark as to how to use it. > > John W. Colby > www.ColbyConsulting.com > > > Stuart McLachlan wrote: > > Can't you use something like: > > > > Update MyTbl > > Set AddrValid = > > (CASE WHEN (ANK IS NOT NULL THEN 'ANK' > > CASE WHEN (AddrValid IS NULL) AND (Addr Like 'PO%') THEN 'PO' > > CASE WHEN (AddrValid IS NULL) AND (Addr Like 'MOVED%') THEN 'MOV' > > CASE WHEN (AddrValid IS NULL) AND (Addr Like '.........%') THEN '...' > > ) > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From jwcolby at colbyconsulting.com Sat Jul 4 09:52:24 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 10:52:24 -0400 Subject: [dba-SQLServer] SPAM-LOW: Re: Is there a better way In-Reply-To: <4A4F6838.874.DB09CE2@stuart.lexacorp.com.pg> References: <4A4F4DD5.4000508@colbyconsulting.com>, <4A4F6249.14029.D996FC9@stuart.lexacorp.com.pg>, <4A4F65AA.6070009@colbyconsulting.com> <4A4F6838.874.DB09CE2@stuart.lexacorp.com.pg> Message-ID: <4A4F6CA8.1070001@colbyconsulting.com> Very cool. Thanks Stuart! John W. Colby www.ColbyConsulting.com Stuart McLachlan wrote: > OK, that was very quick air code with lots of bugs. This one is tested and actually works: > > Update MyTbl > Set AddrValid = > (CASE > WHEN (ANK IS NOT NULL) THEN 'ANK' > WHEN (AddrValid IS NULL) AND (Addr Like 'PO%') THEN 'PO' > WHEN (AddrValid IS NULL) AND (Addr Like 'MOVED%') THEN 'MOV' > END) > > It works like a VBA "Select Case" in that once a condition is met, it drops straight through to > the END > From fhtapia at gmail.com Sat Jul 4 13:08:49 2009 From: fhtapia at gmail.com (Francisco Tapia) Date: Sat, 4 Jul 2009 11:08:49 -0700 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4F60B1.4090908@colbyconsulting.com> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> Message-ID: John, rather than throwing things into the master database I advise you to create a master procedure database and drop in your sprocs and udfs in there. Next time you need to rebuild your system it will be much easier to have your sprocs and udf's easily backed up and restorable. the simplicity of not having to explicitly call master in front of each call is out weighed by having a reliable backup imho. so your calls would be something like mysysdb.dbo.myudfname -Francisco http://sqlthis.blogspot.com | Tsql and More... On Sat, Jul 4, 2009 at 7:01 AM, jwcolby wrote: > Well... I put master.dbo.MyUDFName and it worked just fine. > > John W. Colby > www.ColbyConsulting.com > > > jwcolby wrote: > > BTW I designed the UDF in the Master database in the hopes that it would > be visible from any other > > database when it was time to do an update query. > > > > John W. Colby > > www.ColbyConsulting.com > > > > > > Doris Manning wrote: > >> Dbo.uf_AddrValid > >> > >> -----Original Message----- > >> From: dba-sqlserver-bounces at databaseadvisors.com > >> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > jwcolby > >> Sent: Saturday, July 04, 2009 9:36 AM > >> To: Dba-Sqlserver > >> Subject: [dba-SQLServer] Testing UDFs > >> > >> I am jumping into writing UDFs this morning. I need to test the > results. > >> When I write a query to pull data from a table using the UDF as one of > the > >> columns (just to display what happens) I get: > >> > >> "uf_AddrValid not a recognized built-in function name." > >> > >> Is there a naming convention to allow SQL Server (2005) to understand my > UDF > >> and use them? I know that there was a prefix I had to use in stored > >> procedures. > >> > >> -- > >> 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 > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sat Jul 4 13:49:14 2009 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sat, 4 Jul 2009 14:49:14 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> Message-ID: <29f585dd0907041149i2fa86d26nca7e8a7bfaa3db92@mail.gmail.com> I couldn't agree more. One thing that I would is a mention of the templates available. Open Management Studio and then select View | Templates. A pane will open on the right listing the numerous templates available to you. They write skeleton code for your proc or UDF. In the list of templates, you will find several that pertain to writing UDFs. Here's an article for TechRepublic on using templates: http://articles.techrepublic.com.com/5100-10878_11-5653868.html hth, Arthur From fuller.artful at gmail.com Sat Jul 4 13:54:17 2009 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sat, 4 Jul 2009 14:54:17 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <29f585dd0907041149i2fa86d26nca7e8a7bfaa3db92@mail.gmail.com> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> <29f585dd0907041149i2fa86d26nca7e8a7bfaa3db92@mail.gmail.com> Message-ID: <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com> JC, Here is another TechRepublic article I wrote on UDFs which explains the various kinds and provides sample queries that call UDFs and displays the result set. hth, Arthur From jwcolby at colbyconsulting.com Sat Jul 4 14:18:59 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 15:18:59 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> Message-ID: <4A4FAB23.60905@colbyconsulting.com> You are correct of course; I will do that. Thanks for the suggestion. John W. Colby www.ColbyConsulting.com Francisco Tapia wrote: > John, rather than throwing things into the master database I advise you to > create a master procedure database and drop in your sprocs and udfs in > there. Next time you need to rebuild your system it will be much easier to > have your sprocs and udf's easily backed up and restorable. the simplicity > of not having to explicitly call master in front of each call is out weighed > by having a reliable backup imho. > > so your calls would be something like > > mysysdb.dbo.myudfname > > > -Francisco > http://sqlthis.blogspot.com | Tsql and More... > > > On Sat, Jul 4, 2009 at 7:01 AM, jwcolby wrote: > >> Well... I put master.dbo.MyUDFName and it worked just fine. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> jwcolby wrote: >>> BTW I designed the UDF in the Master database in the hopes that it would >> be visible from any other >>> database when it was time to do an update query. >>> >>> John W. Colby >>> www.ColbyConsulting.com >>> >>> >>> Doris Manning wrote: >>>> Dbo.uf_AddrValid >>>> >>>> -----Original Message----- >>>> From: dba-sqlserver-bounces at databaseadvisors.com >>>> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of >> jwcolby >>>> Sent: Saturday, July 04, 2009 9:36 AM >>>> To: Dba-Sqlserver >>>> Subject: [dba-SQLServer] Testing UDFs >>>> >>>> I am jumping into writing UDFs this morning. I need to test the >> results. >>>> When I write a query to pull data from a table using the UDF as one of >> the >>>> columns (just to display what happens) I get: >>>> >>>> "uf_AddrValid not a recognized built-in function name." >>>> >>>> Is there a naming convention to allow SQL Server (2005) to understand my >> UDF >>>> and use them? I know that there was a prefix I had to use in stored >>>> procedures. >>>> >>>> -- >>>> 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 >>> >>> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Sat Jul 4 14:19:56 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 15:19:56 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> <29f585dd0907041149i2fa86d26nca7e8a7bfaa3db92@mail.gmail.com> <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com> Message-ID: <4A4FAB5C.2090402@colbyconsulting.com> I already stumbled across one of your articles on the subject. John W. Colby www.ColbyConsulting.com Arthur Fuller wrote: > JC, > Here is another TechRepublic article I wrote on UDFs which explains the > various kinds and provides sample queries that call UDFs and displays the > result set. > > hth, > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sat Jul 4 17:37:06 2009 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sat, 4 Jul 2009 18:37:06 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4FAB5C.2090402@colbyconsulting.com> References: <4A4F5ABC.7010108@colbyconsulting.com> <46AA6A01EEF7441290045D1B6801A8EB@Kermit> <4A4F5FE6.1010806@colbyconsulting.com> <4A4F60B1.4090908@colbyconsulting.com> <29f585dd0907041149i2fa86d26nca7e8a7bfaa3db92@mail.gmail.com> <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com> <4A4FAB5C.2090402@colbyconsulting.com> Message-ID: <29f585dd0907041537m6a2fbdd6sf39efa5ab3f22b70@mail.gmail.com> LOL. On Sat, Jul 4, 2009 at 3:19 PM, jwcolby wrote: > I already stumbled across one of your articles on the subject. > > John W. Colby > www.ColbyConsulting.com > > From stuart at lexacorp.com.pg Sat Jul 4 18:07:57 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 05 Jul 2009 09:07:57 +1000 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4FAB5C.2090402@colbyconsulting.com> References: <4A4F5ABC.7010108@colbyconsulting.com>, <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com>, <4A4FAB5C.2090402@colbyconsulting.com> Message-ID: <4A4FE0CD.4643.F87A506@stuart.lexacorp.com.pg> Looks like JC is finally biting the bullet and doing some serious research to build his SQL Server skills. Hey John, it's about time to give BOL another go. You probably understand SQL well enough now to make sense of the examples. On 4 Jul 2009 at 15:19, jwcolby wrote: > I already stumbled across one of your articles on the subject. > > John W. Colby > www.ColbyConsulting.com > > > Arthur Fuller wrote: > > JC, > > Here is another TechRepublic article I wrote on UDFs which explains the > > various kinds and provides sample queries that call UDFs and displays the > > result set. > > > > hth, > > Arthur > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From jwcolby at colbyconsulting.com Sat Jul 4 21:24:38 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 04 Jul 2009 22:24:38 -0400 Subject: [dba-SQLServer] Testing UDFs In-Reply-To: <4A4FE0CD.4643.F87A506@stuart.lexacorp.com.pg> References: <4A4F5ABC.7010108@colbyconsulting.com>, <29f585dd0907041154v127afc4as99dbef34d78d9887@mail.gmail.com>, <4A4FAB5C.2090402@colbyconsulting.com> <4A4FE0CD.4643.F87A506@stuart.lexacorp.com.pg> Message-ID: <4A500EE6.8050504@colbyconsulting.com> > Hey John, it's about time to give BOL another go. Uhhh.... nope! >You probably understand SQL well Uhhh.... nope! John W. Colby www.ColbyConsulting.com Stuart McLachlan wrote: > Looks like JC is finally biting the bullet and doing some serious research to build his SQL > Server skills. > > Hey John, it's about time to give BOL another go. You probably understand SQL well > enough now to make sense of the examples. > > > > > > On 4 Jul 2009 at 15:19, jwcolby wrote: > >> I already stumbled across one of your articles on the subject. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> Arthur Fuller wrote: >>> JC, >>> Here is another TechRepublic article I wrote on UDFs which explains the >>> various kinds and provides sample queries that call UDFs and displays the >>> result set. >>> >>> hth, >>> Arthur >>> _______________________________________________ >>> dba-SQLServer mailing list >>> dba-SQLServer at databaseadvisors.com >>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.com >>> >>> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From fuller.artful at gmail.com Sun Jul 5 05:31:35 2009 From: fuller.artful at gmail.com (Arthur Fuller) Date: Sun, 5 Jul 2009 06:31:35 -0400 Subject: [dba-SQLServer] NoSQL Movement Gains Steam Message-ID: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com> As the old wag said, "When all you have is a hammer, everything looks like a nail." In our case, the hammer is SQL. But some very large companies have decided that for their needs, the overhead of SQL is overkill. These companies include some big names like Facebook and Adobe and several lesser-known but big players (i.e. multiple terabytes and even petabytes of structurally simple data). Facebook replaced MySQL with a system developed in-house called Cassandra, which can write 500 GB of data in 0.12 milliseconds, more than 2500 times faster than MySQL. You can read about this at http://www.infoworld.com/d/open-source/anti-database-movement-gains-steam-924?page=0,0&source=rss_infoworld_news . Arthur From fhtapia at gmail.com Sun Jul 5 11:20:31 2009 From: fhtapia at gmail.com (Francisco Tapia) Date: Sun, 5 Jul 2009 09:20:31 -0700 Subject: [dba-SQLServer] NoSQL Movement Gains Steam In-Reply-To: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com> References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com> Message-ID: <446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> I was reading that article the other day and I got to thinking that may be an excellent alternative for my companies customer portal, scalability of that size can certainly help in situations where users are waiting for the system to spit back out the details of their order ( large BOMs etc ) Sent from my mobile On Jul 5, 2009, at 3:31 AM, Arthur Fuller wrote: > As the old wag said, "When all you have is a hammer, everything > looks like a > nail." In our case, the hammer is SQL. But some very large companies > have > decided that for their needs, the overhead of SQL is overkill. These > companies include some big names like Facebook and Adobe and several > lesser-known but big players (i.e. multiple terabytes and even > petabytes of > structurally simple data). Facebook replaced MySQL with a system > developed > in-house called Cassandra, which can write 500 GB of data in 0.12 > milliseconds, more than 2500 times faster than MySQL. > You can read about this at > http://www.infoworld.com/d/open-source/anti-database-movement-gains-steam-924?page=0,0&source=rss_infoworld_news > . > > Arthur > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From Darryl.Collins at coles.com.au Tue Jul 7 23:42:17 2009 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Wed, 8 Jul 2009 14:42:17 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package In-Reply-To: <446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com> <446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> Message-ID: <57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au> Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From jwcolby at colbyconsulting.com Wed Jul 8 07:31:29 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 08 Jul 2009 08:31:29 -0400 Subject: [dba-SQLServer] Set memory use without Management Studio Message-ID: <4A5491A1.1000405@colbyconsulting.com> I have a Windows Media Center (WMC) PC feeding movies to my TV. That PC uses an add-in called MyMovies which allows me to access movies stored on a server up in my office. MyMovies uses a SQL Server Express database to hold all of the data used to feed the MyMovies application running on the WMC PC. Because it seemed logical to do so, I set up the MyMovies database on my Windows Home Server (WHS) PC up in my office, and all of the movies are physically stored there as well. Pretty much since day one, MyMovies has had really long delays getting at the movie information, delays which show themselves as long pauses whenever you do ANYTHING in the MyMovies submenu inside of Windows Media Center. All other parts of WMC are very speedy, so it was obvious that MyMovies was the culprit. Last night I decided to go poking around the database. For some reason I was able to see but unable to access the MyMovies database from Management Studio on my other machines, so I installed Management Studio Express on my WHS machine and I can now see and manipulate the MyMovies database. The first thing I did was look at the memory assigned to the SQL Server instance and, sure enough, as is SQL Server's wont, SQL Server was assigned a minimum and maximum amount and the maximum amount was some ludicrously high terabyte figure. IOW SQL Server was told it could have ALL of the memory of the machine it is running on. This happens in the default installation AFAICT. So, I adjusted that figure to give SQL Server 1/2 of the machine min and max and voila, the speed issues with MyMovies appear to be solved. I have seen this in my business dealings with SQL Server, if SQL Server is assigned all the PCs memory it takes it, even if not needed, and then it can take a looooooooonnnnnnngggggg time giving some back when requested. So my question is, is there a way to manipulate this setting without going through Management Studio? I want to email the developer and suggest that he look at this issue and perhaps set the default values to something specific and sensible, but it would be nice to have a suggestion about how his program can access this parameter directly. TIA for your help, -- John W. Colby www.ColbyConsulting.com From nancy.lytle at gmail.com Wed Jul 8 08:03:12 2009 From: nancy.lytle at gmail.com (Nancy Lytle) Date: Wed, 8 Jul 2009 08:03:12 -0500 Subject: [dba-SQLServer] Set memory use without Management Studio In-Reply-To: <4A5491A1.1000405@colbyconsulting.com> References: <4A5491A1.1000405@colbyconsulting.com> Message-ID: This is what I use. EXEC sp_configure 'show advanced options', 1 RECONFIGURE WITH OVERRIDE; GO sp_configure 'allow updates', 0; GO RECONFIGURE WITH OVERRIDE; GO EXEC SP_CONFIGURE 'Max Server Memory', 2048; RECONFIGURE WITH OVERRIDE; GO Nancy Lytle N_Lytle at terpalum.umd.edu EMAILING FOR THE GREATER GOOD Join me > Date: Wed, 8 Jul 2009 08:31:29 -0400 > From: jwcolby at colbyconsulting.com > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer] Set memory use without Management Studio > > I have a Windows Media Center (WMC) PC feeding movies to my TV. That PC uses an add-in called > MyMovies which allows me to access movies stored on a server up in my office. MyMovies uses a SQL > Server Express database to hold all of the data used to feed the MyMovies application running on the > WMC PC. Because it seemed logical to do so, I set up the MyMovies database on my Windows Home > Server (WHS) PC up in my office, and all of the movies are physically stored there as well. > > Pretty much since day one, MyMovies has had really long delays getting at the movie information, > delays which show themselves as long pauses whenever you do ANYTHING in the MyMovies submenu inside > of Windows Media Center. All other parts of WMC are very speedy, so it was obvious that MyMovies > was the culprit. > > Last night I decided to go poking around the database. For some reason I was able to see but unable > to access the MyMovies database from Management Studio on my other machines, so I installed > Management Studio Express on my WHS machine and I can now see and manipulate the MyMovies database. > > The first thing I did was look at the memory assigned to the SQL Server instance and, sure enough, > as is SQL Server's wont, SQL Server was assigned a minimum and maximum amount and the maximum amount > was some ludicrously high terabyte figure. IOW SQL Server was told it could have ALL of the memory > of the machine it is running on. This happens in the default installation AFAICT. > > So, I adjusted that figure to give SQL Server 1/2 of the machine min and max and voila, the speed > issues with MyMovies appear to be solved. > > I have seen this in my business dealings with SQL Server, if SQL Server is assigned all the PCs > memory it takes it, even if not needed, and then it can take a looooooooonnnnnnngggggg time giving > some back when requested. > > So my question is, is there a way to manipulate this setting without going through Management > Studio? I want to email the developer and suggest that he look at this issue and perhaps set the > default values to something specific and sensible, but it would be nice to have a suggestion about > how his program can access this parameter directly. > > TIA for your help, > > -- > 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 Jul 8 08:19:03 2009 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 08 Jul 2009 09:19:03 -0400 Subject: [dba-SQLServer] Set memory use without Management Studio In-Reply-To: References: <4A5491A1.1000405@colbyconsulting.com> Message-ID: <4A549CC7.806@colbyconsulting.com> Cool, thanks. I sent that along to the developer. John W. Colby www.ColbyConsulting.com Nancy Lytle wrote: > This is what I use. > > > > > > EXEC sp_configure 'show advanced options', 1 > > RECONFIGURE WITH OVERRIDE; > > GO > > sp_configure 'allow updates', 0; > > GO > > RECONFIGURE WITH OVERRIDE; > > GO > > EXEC SP_CONFIGURE 'Max Server Memory', 2048; > > RECONFIGURE WITH OVERRIDE; > > GO > > > > > > > Nancy Lytle > N_Lytle at terpalum.umd.edu > > > > > > > > > > > > EMAILING FOR THE GREATER GOOD > Join me > > > >> Date: Wed, 8 Jul 2009 08:31:29 -0400 >> From: jwcolby at colbyconsulting.com >> To: dba-sqlserver at databaseadvisors.com >> Subject: [dba-SQLServer] Set memory use without Management Studio >> >> I have a Windows Media Center (WMC) PC feeding movies to my TV. That PC uses an add-in called >> MyMovies which allows me to access movies stored on a server up in my office. MyMovies uses a SQL >> Server Express database to hold all of the data used to feed the MyMovies application running on the >> WMC PC. Because it seemed logical to do so, I set up the MyMovies database on my Windows Home >> Server (WHS) PC up in my office, and all of the movies are physically stored there as well. >> >> Pretty much since day one, MyMovies has had really long delays getting at the movie information, >> delays which show themselves as long pauses whenever you do ANYTHING in the MyMovies submenu inside >> of Windows Media Center. All other parts of WMC are very speedy, so it was obvious that MyMovies >> was the culprit. >> >> Last night I decided to go poking around the database. For some reason I was able to see but unable >> to access the MyMovies database from Management Studio on my other machines, so I installed >> Management Studio Express on my WHS machine and I can now see and manipulate the MyMovies database. >> >> The first thing I did was look at the memory assigned to the SQL Server instance and, sure enough, >> as is SQL Server's wont, SQL Server was assigned a minimum and maximum amount and the maximum amount >> was some ludicrously high terabyte figure. IOW SQL Server was told it could have ALL of the memory >> of the machine it is running on. This happens in the default installation AFAICT. >> >> So, I adjusted that figure to give SQL Server 1/2 of the machine min and max and voila, the speed >> issues with MyMovies appear to be solved. >> >> I have seen this in my business dealings with SQL Server, if SQL Server is assigned all the PCs >> memory it takes it, even if not needed, and then it can take a looooooooonnnnnnngggggg time giving >> some back when requested. >> >> So my question is, is there a way to manipulate this setting without going through Management >> Studio? I want to email the developer and suggest that he look at this issue and perhaps set the >> default values to something specific and sensible, but it would be nice to have a suggestion about >> how his program can access this parameter directly. >> >> TIA for your help, >> >> -- >> 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 michael at ddisolutions.com.au Wed Jul 8 19:58:47 2009 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 9 Jul 2009 10:58:47 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com><446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> <57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> Hi Darryl, I'm pretty sure you can create a DTS package in 2K and just add a Execute Package Task object and away you go. Add and chain as many as you like. Cheers Michael -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darryl Collins Sent: Wednesday, 8 July 2009 2:42 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Run a DTS package from another DTS Package Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Darryl.Collins at coles.com.au Wed Jul 8 20:10:02 2009 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Thu, 9 Jul 2009 11:10:02 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com><446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> <57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au> <59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> Message-ID: <57E6E6CA42105A48B977303A2CDC2720081C00D097@WPEXCH22.retail.ad.cmltd.net.au> ok... thanks Michael. I will look into this futher today. I was using xp_shell, but it turns out we don't have permissions for that either. Will look at this more. Thanks for your thoughts on this Regards Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, 9 July 2009 10:59 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Run a DTS package from another DTS Package Hi Darryl, I'm pretty sure you can create a DTS package in 2K and just add a Execute Package Task object and away you go. Add and chain as many as you like. Cheers Michael -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darryl Collins Sent: Wednesday, 8 July 2009 2:42 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Run a DTS package from another DTS Package Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From michael at ddisolutions.com.au Wed Jul 8 20:44:37 2009 From: michael at ddisolutions.com.au (Michael Maddison) Date: Thu, 9 Jul 2009 11:44:37 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com><446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com><57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au><59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> <57E6E6CA42105A48B977303A2CDC2720081C00D097@WPEXCH22.retail.ad.cmltd.net.au> Message-ID: <59A61174B1F5B54B97FD4ADDE71E7D0158202F@ddi-01.DDI.local> Darryl, You may need to get your network guys to change the SQL Agent permissions to a domain admin account. That should fix your problems :-) Cheers Michael ok... thanks Michael. I will look into this futher today. I was using xp_shell, but it turns out we don't have permissions for that either. Will look at this more. Thanks for your thoughts on this Regards Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, 9 July 2009 10:59 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Run a DTS package from another DTS Package Hi Darryl, I'm pretty sure you can create a DTS package in 2K and just add a Execute Package Task object and away you go. Add and chain as many as you like. Cheers Michael -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darryl Collins Sent: Wednesday, 8 July 2009 2:42 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Run a DTS package from another DTS Package Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Darryl.Collins at coles.com.au Wed Jul 8 21:12:01 2009 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Thu, 9 Jul 2009 12:12:01 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0158202F@ddi-01.DDI.local> References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com><446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com><57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au><59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> <57E6E6CA42105A48B977303A2CDC2720081C00D097@WPEXCH22.retail.ad.cmltd.net.au> <59A61174B1F5B54B97FD4ADDE71E7D0158202F@ddi-01.DDI.local> Message-ID: <57E6E6CA42105A48B977303A2CDC2720081C00D099@WPEXCH22.retail.ad.cmltd.net.au> Yeah... I know. The company policy is giving me grief in this area. The annoying thing is I can create the DTS packages and manually run them as often as I want, I am just having a hell time getting the scheduled so they automatically execute once a day. *sheeesh!!* I know it shouldn't be this hard, but due to permission issues, it is. Big company - they are not interested in changing their policy for lill ol' me. If necessary I can make up a control-m agent for each DTS and run them individually, it is just a PITA to have to take that approach. *shrugs* oh well... Cheers Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, 9 July 2009 11:45 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Run a DTS package from another DTS Package Darryl, You may need to get your network guys to change the SQL Agent permissions to a domain admin account. That should fix your problems :-) Cheers Michael ok... thanks Michael. I will look into this futher today. I was using xp_shell, but it turns out we don't have permissions for that either. Will look at this more. Thanks for your thoughts on this Regards Darryl -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, 9 July 2009 10:59 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Run a DTS package from another DTS Package Hi Darryl, I'm pretty sure you can create a DTS package in 2K and just add a Execute Package Task object and away you go. Add and chain as many as you like. Cheers Michael -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darryl Collins Sent: Wednesday, 8 July 2009 2:42 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Run a DTS package from another DTS Package Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From Darryl.Collins at coles.com.au Wed Jul 8 21:27:10 2009 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Thu, 9 Jul 2009 12:27:10 +1000 Subject: [dba-SQLServer] Run a DTS package from another DTS Package In-Reply-To: <59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> References: <29f585dd0907050331q3ef9ba60k165d1151416c3000@mail.gmail.com><446CB340-6AA2-44DC-B09E-F3EE559B1E30@gmail.com> <57E6E6CA42105A48B977303A2CDC2720081C00D092@WPEXCH22.retail.ad.cmltd.net.au> <59A61174B1F5B54B97FD4ADDE71E7D0158202E@ddi-01.DDI.local> Message-ID: <57E6E6CA42105A48B977303A2CDC2720081C00D09A@WPEXCH22.retail.ad.cmltd.net.au> aaah, Taking this approach seemed to have worked (well, so far - I can certainly run all of the packages by executing a single DTS package). Next step is to see if I can get Control-M to execute the single package ok - which is another issue outside of the scope of this list. Looks promising though. Many thanks for this - probably obvious I guess, but I am still pretty green around parts of SQL Server that I don't use daily so your help is really appreciated. cheers Darryl. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Maddison Sent: Thursday, 9 July 2009 10:59 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Run a DTS package from another DTS Package Hi Darryl, I'm pretty sure you can create a DTS package in 2K and just add a Execute Package Task object and away you go. Add and chain as many as you like. Cheers Michael -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Darryl Collins Sent: Wednesday, 8 July 2009 2:42 PM To: 'Discussion concerning MS SQL Server' Subject: [dba-SQLServer] Run a DTS package from another DTS Package Hi Folks, Due to user restrictions at work we have to jump thru many hoops to automatically schedule a DTS package to run. To this end we use 3rd party software called "control-m". The control M agent is set up to run a DTS package on SQL Server (2000 in this instance). As the agent can only call one DTS package at a time and I have many I need to run, I want to be able to get Control M to call one DTS package, and that package in turn will execute all the other DTS packages I require. Been poking around on Google without much luck. Everyone seems to assume I can just "schedule" the existing DTS in SQL server, which I cannot. Anyway... Can anyone help point me in the right direction with this. cheers Darryl. This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. _______________________________________________ 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 This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From dwaters at usinternet.com Fri Jul 10 09:47:00 2009 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 10 Jul 2009 09:47:00 -0500 Subject: [dba-SQLServer] Determining Logged in Users? Message-ID: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> If I have multiple Access FE's / one SQL BE, and I'm not using Access's username/password method, what can I do to see who is logged in to database? I'll be using ODBC table links to the BE. Does SQL keep track of users who are connected? How could I reach that list? Thanks! Dan From stuart at lexacorp.com.pg Fri Jul 10 10:39:27 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 11 Jul 2009 01:39:27 +1000 Subject: [dba-SQLServer] Determining Logged in Users? In-Reply-To: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> References: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> Message-ID: <4A5760AF.18665.2CD331D4@stuart.lexacorp.com.pg> In the Management Studio, under Management - Activity Logs - Process Info, you can see a list of all current Users and Processes. On 10 Jul 2009 at 9:47, Dan Waters wrote: > > If I have multiple Access FE's / one SQL BE, and I'm not using Access's > username/password method, what can I do to see who is logged in to database? > > > I'll be using ODBC table links to the BE. Does SQL keep track of users who > are connected? How could I reach that list? > > Thanks! > Dan > > _______________________________________________ > 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 Jul 10 11:01:25 2009 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 10 Jul 2009 11:01:25 -0500 Subject: [dba-SQLServer] Determining Logged in Users? In-Reply-To: <4A5760AF.18665.2CD331D4@stuart.lexacorp.com.pg> References: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> <4A5760AF.18665.2CD331D4@stuart.lexacorp.com.pg> Message-ID: <28916D405F764BEFBF50DE43D421ACF9@danwaters> Thanks Stuart - I forgot to say that I need to do this programmatically. This system has user licenses, and I need to be able to prevent more people from logging in than my customer has purchased licenses for. Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Friday, July 10, 2009 10:39 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Determining Logged in Users? In the Management Studio, under Management - Activity Logs - Process Info, you can see a list of all current Users and Processes. On 10 Jul 2009 at 9:47, Dan Waters wrote: > > If I have multiple Access FE's / one SQL BE, and I'm not using Access's > username/password method, what can I do to see who is logged in to database? > > > I'll be using ODBC table links to the BE. Does SQL keep track of users who > are connected? How could I reach that list? > > 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 stuart at lexacorp.com.pg Fri Jul 10 11:24:12 2009 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 11 Jul 2009 02:24:12 +1000 Subject: [dba-SQLServer] Determining Logged in Users? In-Reply-To: <28916D405F764BEFBF50DE43D421ACF9@danwaters> References: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters>, <4A5760AF.18665.2CD331D4@stuart.lexacorp.com.pg>, <28916D405F764BEFBF50DE43D421ACF9@danwaters> Message-ID: <4A576B2C.15915.2CFC2CC6@stuart.lexacorp.com.pg> There is a system stored procedure sp_who which returns lots of details about current users and processes. Stripping the guts out of that procedure and tweaking it a bit I came up with this: select distinct loginame=rtrim(loginame), hostname, dbname = db_name(dbid) from master.dbo.sysprocesses where spid >= 0 and spid <= 32767 and dbid <> 0 You can refine it a bit further by limiting to it the name of the database you are interested in. On 10 Jul 2009 at 11:01, Dan Waters wrote: > Thanks Stuart - > > I forgot to say that I need to do this programmatically. This system has > user licenses, and I need to be able to prevent more people from logging in > than my customer has purchased licenses for. > > Dan > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart > McLachlan > Sent: Friday, July 10, 2009 10:39 AM > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] Determining Logged in Users? > > In the Management Studio, under Management - Activity Logs - Process Info, > you can see a > list of all current Users and Processes. > > On 10 Jul 2009 at 9:47, Dan Waters wrote: > > > > > If I have multiple Access FE's / one SQL BE, and I'm not using Access's > > username/password method, what can I do to see who is logged in to > database? > > > > > > I'll be using ODBC table links to the BE. Does SQL keep track of users > who > > are connected? How could I reach that list? > > > > 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 dwaters at usinternet.com Fri Jul 10 11:36:56 2009 From: dwaters at usinternet.com (Dan Waters) Date: Fri, 10 Jul 2009 11:36:56 -0500 Subject: [dba-SQLServer] Determining Logged in Users? In-Reply-To: <4A576B2C.15915.2CFC2CC6@stuart.lexacorp.com.pg> References: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters>, <4A5760AF.18665.2CD331D4@stuart.lexacorp.com.pg>, <28916D405F764BEFBF50DE43D421ACF9@danwaters> <4A576B2C.15915.2CFC2CC6@stuart.lexacorp.com.pg> Message-ID: Thanks! Sounds perfect. Dan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Friday, July 10, 2009 11:24 AM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] Determining Logged in Users? There is a system stored procedure sp_who which returns lots of details about current users and processes. Stripping the guts out of that procedure and tweaking it a bit I came up with this: select distinct loginame=rtrim(loginame), hostname, dbname = db_name(dbid) from master.dbo.sysprocesses where spid >= 0 and spid <= 32767 and dbid <> 0 You can refine it a bit further by limiting to it the name of the database you are interested in. On 10 Jul 2009 at 11:01, Dan Waters wrote: > Thanks Stuart - > > I forgot to say that I need to do this programmatically. This system has > user licenses, and I need to be able to prevent more people from logging in > than my customer has purchased licenses for. > > Dan > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Stuart > McLachlan > Sent: Friday, July 10, 2009 10:39 AM > To: Discussion concerning MS SQL Server > Subject: Re: [dba-SQLServer] Determining Logged in Users? > > In the Management Studio, under Management - Activity Logs - Process Info, > you can see a > list of all current Users and Processes. > > On 10 Jul 2009 at 9:47, Dan Waters wrote: > > > > > If I have multiple Access FE's / one SQL BE, and I'm not using Access's > > username/password method, what can I do to see who is logged in to > database? > > > > > > I'll be using ODBC table links to the BE. Does SQL keep track of users > who > > are connected? How could I reach that list? > > > > 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 Darryl.Collins at coles.com.au Sun Jul 12 19:54:23 2009 From: Darryl.Collins at coles.com.au (Darryl Collins) Date: Mon, 13 Jul 2009 10:54:23 +1000 Subject: [dba-SQLServer] Determining Logged in Users? In-Reply-To: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> References: <58D9EB1E7D6E473B97973A7EAFADDF5A@danwaters> Message-ID: <57E6E6CA42105A48B977303A2CDC2720081C00D0B6@WPEXCH22.retail.ad.cmltd.net.au> Dan, I use this, which can be called from anywhere from the Access FE - usually on the startup/Exit form is sensible. AddAuditEvent ("Log Off - v" & strAppVersion) and / or AddAuditEvent ("Log On - v" & strAppVersion) '-------------- Code Start -------------------- Option Compare Database Option Explicit Public Sub AddAuditEvent(strMsg As String) '***********************************************' ' ' ' This Procedure handles all audit events for ' ' this application. It logs to the audit ' ' any string passed to it from anywhere ' ' within the application. ' ' ' ' This function automatically adds the ' ' username, machine name and timestamp ' ' to the audit record ' ' ' ' Created by Beny Aycardo ' ' Started on 23 March 2006 ' ' ' '***********************************************' Dim sql As String Dim cnn As ADODB.Connection On Error GoTo ErrHandler Set cnn = New ADODB.Connection 'Clean up the audit message string so it can be passed to the 'stored Procedure strMsg = Replace(strMsg, "'", "") 'Add a new record to the error log table 'craft the call to the stored procedure sql = "stprAddAuditLog " & _ "'" & GetUserNameAPI() & "'" & ", " & _ "'" & GetComputerNameAPI() & "'" & ", " & _ "'" & strMsg & "'" & ", " & _ "'" & strAuditTable & "'" 'Debug.Print sql cnn.Open DbADOConStr cnn.Execute (sql) ExitHere: On Error Resume Next cnn.Close Set cnn = Nothing Exit Sub ErrHandler: strErrMsg = "ModAudit.AddAuditEvent " strErrMsg = strErrMsg & Err.Number & " - " & Err.Description & vbCrLf & vbCrLf ErrHandle (strErrMsg) Resume ExitHere End Sub '---------------Code End-------------------------- '------------ SQL SERVER SPROC--------------------- if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[stprAddAuditLog]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[stprAddAuditLog] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO /* This Stored Procedure adds a new record to the Audit Log table. */ CREATE PROCEDURE [dbo].[stprAddAuditLog] @UserName NVARCHAR(12), -- User Name @MachineName NVARCHAR(12), -- Machine Name @AuditMsg NVARCHAR(1500), -- Audit Message @AuditTable NVARCHAR(100) -- Destination Audit Table Name AS SET NOCOUNT ON DECLARE @SQL NVARCHAR(4000) SELECT @SQL = 'INSERT INTO ' + @AuditTable SELECT @SQL = @SQL + ' (UserName,MachineName,AuditMsg) VALUES (' + '''' SELECT @SQL = @SQL + @UserName + '''' + ',' + '''' SELECT @SQL = @SQL + @MachineName + '''' + ',' + '''' SELECT @SQL = @SQL + @AuditMsg + '''' + ')' EXECUTE (@SQL) SET QUOTED_IDENTIFIER OFF GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO '-------- END SPROC --------------------- -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Saturday, 11 July 2009 12:47 AM To: SQL Server List Subject: [dba-SQLServer] Determining Logged in Users? If I have multiple Access FE's / one SQL BE, and I'm not using Access's username/password method, what can I do to see who is logged in to database? I'll be using ODBC table links to the BE. Does SQL keep track of users who are connected? How could I reach that list? Thanks! Dan _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses. No warranty is made that this material is free from computer virus or any other defect or error. Any loss/damage incurred by using this material is not the sender's responsibility. The sender's entire liability will be limited to resupplying the material. From ssharkins at gmail.com Thu Jul 16 20:15:02 2009 From: ssharkins at gmail.com (Susan Harkins) Date: Thu, 16 Jul 2009 21:15:02 -0400 Subject: [dba-SQLServer] Another one from Francisco Message-ID: <7E0EB52AB73E444E975F23DECFA6CB22@SusanOne> http://www.devx.com/dbzone/Article/42340?trk=DXRSS_LATEST Susan H. From marklbreen at gmail.com Fri Jul 17 06:12:18 2009 From: marklbreen at gmail.com (Mark Breen) Date: Fri, 17 Jul 2009 12:12:18 +0100 Subject: [dba-SQLServer] Another one from Francisco In-Reply-To: <7E0EB52AB73E444E975F23DECFA6CB22@SusanOne> References: <7E0EB52AB73E444E975F23DECFA6CB22@SusanOne> Message-ID: Hello All, and Francisco, super articles, just having fun with a 5 GB database, tha I know know has 1600 columns and I can search for any phrase. One thing to mention to Francisco, the search all tables and columns file has an sql extention, but it contains Rich Text formatting, it might be better to either change the ext to .rtf, or else strip out the rfc characters and leave it as .sql. The code is super, thanks Francisco and Susan, Mark 2009/7/17 Susan Harkins > http://www.devx.com/dbzone/Article/42340?trk=DXRSS_LATEST > > Susan H. > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >