From my.lists at verizon.net Sun Feb 1 00:40:22 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Sat, 31 Jan 2004 22:40:22 -0800 Subject: [dba-SQLServer] Re: [AccessD] was SQL Server queries - appending strings In-Reply-To: References: Message-ID: <401C9F56.6010809@verizon.net> John W. Colby wrote: > Thanks both of you. > > I have a client that purchased SQL Server and so it's time to get off the > dime and learn this stuff. > > The client uses A2K. > > Now that I am changing to SQL Server I have to get the server doing more of > the work - the whole point is of course to speed things up. For technical > reasons (a whole SLEW of reasons) going to an ADP is NOT an option any time > in the near future, if at all. It's really about the right tool for the job, altho speculation would deem that an ADP would be better suited. > I have a main tabbed form which uses a multi-table join to get live data > from a client / claim . The client wanted it that way so that the user > could edit fields in either table. > > Views appear to be similar to tables, i.e. I can link to them and they show > up in the table window. Is there a way to pass parameters to them? "Where > LastName like col*" etc? No, Views do not take parameters, that's what Stored Procedures (aka sprocs) are for.. > ATM, I pull the whole recordset and then filter down to a single record. > Not fast, but after the initial pull the filter proceeds at a reasonable > rate. I can then "filter" to a specific claim reasonably fast. I would > like to change this to actually ask SQL Server for a view of exactly one > record each time they want to see a claim. Thus avoiding the "pull the > entire recordset across the net, now pull the index, etc. That would be effective.. again... Sprocs, think Pass-Through Queries.. generally you'd just type into the SQL window (technically not the qbe window), EXEC stp_MyFavoriteSproc Param1, Param2 I'll take this quote from David McAfee's post over on Access-L on exactly this issue /QUOTE/ I couldn't get it working that way after all. I cant remember how I used to do that. but... In one of my samples (A97 db connected to A97 BE with an ODBC link to SQL 2K) I created a pass-through query called "_BrettsPassThru" The SQL inside the query is: EXEC devREDe.dbo.BrettsPOQuery '1/1/2004', '1/22/2004' So I created a command button and placed the following code behind it: CurrentDb.QueryDefs("_BrettsPassThru").SQL = "EXEC devREDe.dbo.BrettsPOQuery '" & Forms![Monthlyreport]![StartDate] & "', '" & Forms![Monthlyreport]![EndDate] & "'" 'strSQL DoCmd.OpenQuery "_BrettsPassThru" Let me know how it works for you. David /END QUOTE/ > This must be editable so AFAIK I cannot use stored procedures which would > allow passing parameters. Because this is A2K AFAIK I cannot assign a > recordset to the form's recordsource property. you are mistaken. you can assign the recordset to the recordsource, but because the data is from sql server (in an mdb) it becomes read only. > What are my options here? Do I have any? Pass Through, convert the mdb to an ADP, Stored procedures. and Yes you do :) -- -Francisco From tuxedo_man at hotmail.com Sun Feb 1 01:05:03 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Sun, 01 Feb 2004 07:05:03 +0000 Subject: [dba-SQLServer]SQL Server queries - appending strings Message-ID: SELECT LASTNAME + ', ' + FIRSTNAME from employees........... HTH Billy >From: "John W. Colby" >Reply-To: dba-sqlserver at databaseadvisors.com >To: "SQLServer" , "AccessD" > >Subject: [dba-SQLServer]SQL Server queries - appending strings >Date: Sat, 31 Jan 2004 20:44:31 -0500 > >In Access I often do things in queries like: [LastName] & ", " & >[FirstName] > >This appears to be bad syntax in SQL Server. Is there an equivalent? > >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 > _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From Clay.Passick at minneapolis.edu Mon Feb 2 09:04:51 2004 From: Clay.Passick at minneapolis.edu (Clay Passick) Date: Mon, 02 Feb 2004 09:04:51 -0600 Subject: [dba-SQLServer]SQL Server queries - appending strings Message-ID: [lastname]+', '+[firstname] should work Clay Passick D.B.A. MCTC 1501 Hennepin Avenue Minneapolis, MN 55403 612.659.6615 >>> jwcolby at colbyconsulting.com 1/31/2004 7:44:31 PM >>> In Access I often do things in queries like: [LastName] & ", " & [FirstName] This appears to be bad syntax in SQL Server. Is there an equivalent? 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 martyconnelly at shaw.ca Mon Feb 2 23:10:08 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Mon, 02 Feb 2004 21:10:08 -0800 Subject: [dba-SQLServer] SQL Server Reporting Services Article and use of Access VBA Reports References: Message-ID: <401F2D30.5090708@shaw.ca> Microsoft launches SQL Server Reporting Services http://www.nwfusion.com/news/2004/0127microlaunc.html This has just come out of Beta last week but one interesting point in the article is , "First Premier is also a Microsoft shop and had been building reports using SQL Query Analyzer and Microsoft's Access database. It was able virtually to cut and paste the Access code into Reporting Services, which was a time saver and a big draw" To test and design this you will have to run from Win XP Pro or Win 2003. -- Marty Connelly Victoria, B.C. Canada From artful at rogers.com Tue Feb 3 11:33:14 2004 From: artful at rogers.com (Arthur Fuller) Date: Tue, 3 Feb 2004 12:33:14 -0500 Subject: [dba-SQLServer]Object Name Length Rule? In-Reply-To: <401F2D30.5090708@shaw.ca> Message-ID: Does anyone know how long an object name can be in SQL? TIA, Arthur --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004 From Robert.Djabarov at usaa.com Tue Feb 3 11:43:24 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Tue, 3 Feb 2004 11:43:24 -0600 Subject: [dba-SQLServer]Object Name Length Rule? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003D052E2@ex02.eagle.usaa.com> What do you mean? Are you referring to scope of a variable? -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Tuesday, February 03, 2004 11:33 AM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Object Name Length Rule? Does anyone know how long an object name can be in SQL? TIA, Arthur --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From James at fcidms.com Tue Feb 3 13:09:12 2004 From: James at fcidms.com (James Barash) Date: Tue, 3 Feb 2004 14:09:12 -0500 Subject: [dba-SQLServer]Object Name Length Rule? In-Reply-To: Message-ID: For SQL Server 2000: 128 characters, according to BOL. James Barash -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Tuesday, February 03, 2004 12:33 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Object Name Length Rule? Does anyone know how long an object name can be in SQL? TIA, Arthur --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Tue Feb 3 15:14:48 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Tue, 03 Feb 2004 15:14:48 -0600 Subject: [dba-SQLServer]Re: Object Name Length Rule? In-Reply-To: <200402031800.i13I0dm22034@databaseadvisors.com> Message-ID: <5.1.0.14.2.20040203151412.029a9e60@pop3.highstream.net> Arthur, I believe it is 64 characters. Robert At 12:00 PM 2/3/2004 -0600, you wrote: >Date: Tue, 3 Feb 2004 12:33:14 -0500 >From: "Arthur Fuller" >Subject: [dba-SQLServer]Object Name Length Rule? >To: >Message-ID: >Content-Type: text/plain; charset="Windows-1252" > >Does anyone know how long an object name can be in SQL? > >TIA, >Arthur From Robert.Djabarov at usaa.com Tue Feb 3 15:21:00 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Tue, 3 Feb 2004 15:21:00 -0600 Subject: [dba-SQLServer]Re: Object Name Length Rule? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003D05352@ex02.eagle.usaa.com> It's obvious, I did misunderstand the question, but it is 128 chars. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Tuesday, February 03, 2004 3:15 PM To: dba-sqlserver at databaseadvisors.com Cc: artful at rogers.com Subject: [dba-SQLServer]Re: Object Name Length Rule? Arthur, I believe it is 64 characters. Robert At 12:00 PM 2/3/2004 -0600, you wrote: >Date: Tue, 3 Feb 2004 12:33:14 -0500 >From: "Arthur Fuller" >Subject: [dba-SQLServer]Object Name Length Rule? >To: >Message-ID: >Content-Type: text/plain; charset="Windows-1252" > >Does anyone know how long an object name can be in SQL? > >TIA, >Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From tuxedo_man at hotmail.com Wed Feb 4 13:31:31 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Wed, 04 Feb 2004 19:31:31 +0000 Subject: [dba-SQLServer]Weird error message Message-ID: Has anyone ever received the following error message before? It occurs sporadicaly in my function but the funny thing is, I don't even have a datetime var in my function. Server: Msg 542, Level 16, State 1, Procedure udf_show_this, Line 8 An invalid datetime value was encountered. Value exceeds the year 9999. Thanks in advance, Billy _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca From Robert.Djabarov at usaa.com Wed Feb 4 14:59:13 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 4 Feb 2004 14:59:13 -0600 Subject: [dba-SQLServer]Weird error message Message-ID: <3CCEA32DFF043C4CB99B835557E11B3004341D37@ex02.eagle.usaa.com> Can you post the function? -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy Pang Sent: Wednesday, February 04, 2004 1:32 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer]Weird error message Has anyone ever received the following error message before? It occurs sporadicaly in my function but the funny thing is, I don't even have a datetime var in my function. Server: Msg 542, Level 16, State 1, Procedure udf_show_this, Line 8 An invalid datetime value was encountered. Value exceeds the year 9999. Thanks in advance, Billy _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2f join.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From tuxedo_man at hotmail.com Wed Feb 4 16:51:01 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Wed, 04 Feb 2004 22:51:01 +0000 Subject: [dba-SQLServer]Weird error message Message-ID: CREATE FUNCTION udf_show_this (@tblOrder_ID INT) RETURNS VARCHAR(8000) AS BEGIN DECLARE @strMsg VARCHAR(8000) DECLARE @i TINYINT SET @i = 0 SELECT @strMsg = 'x' + CAST(@tblOrder_ID AS VARCHAR(8)) + 'x', @tblOrder_ID = tblOrder_fk_ID FROM tblOrder WHERE tblOrder_ID = @tblOrder_ID WHILE @tblOrder_ID <> 0 BEGIN SET @i = @i + 1 SELECT @strMsg = 'x' + CAST(tblOrder_ID AS VARCHAR(8)) + @strMsg, @tblOrder_ID = tblOrder_fk_ID FROM tblOrder WITH (NOLOCK) WHERE tblOrder_ID = @tblOrder_ID IF @i > 10 BREAK END RETURN (@strMsg) END GO >From: "Djabarov, Robert" >Reply-To: dba-sqlserver at databaseadvisors.com >To: >Subject: RE: [dba-SQLServer]Weird error message >Date: Wed, 4 Feb 2004 14:59:13 -0600 > >Can you post the function? > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy >Pang >Sent: Wednesday, February 04, 2004 1:32 PM >To: dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]Weird error message > > >Has anyone ever received the following error message before? It occurs >sporadicaly in my function but the funny thing is, I don't even have a >datetime var in my function. > >Server: Msg 542, Level 16, State 1, Procedure udf_show_this, Line 8 An >invalid datetime value was encountered. Value exceeds the year 9999. > >Thanks in advance, >Billy > >_________________________________________________________________ >MSN 8 with e-mail virus protection service: 2 months FREE* >http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2f >join.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca > >_______________________________________________ >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 > _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From Robert.Djabarov at usaa.com Wed Feb 4 17:11:37 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 4 Feb 2004 17:11:37 -0600 Subject: [dba-SQLServer]Weird error message Message-ID: <3CCEA32DFF043C4CB99B835557E11B3004341D77@ex02.eagle.usaa.com> Are there any DATETIME fields in tblOrder table? It's obviously data-related, but not necessarily is barking at the fields referenced in the function. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy Pang Sent: Wednesday, February 04, 2004 4:51 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer]Weird error message CREATE FUNCTION udf_show_this (@tblOrder_ID INT) RETURNS VARCHAR(8000) AS BEGIN DECLARE @strMsg VARCHAR(8000) DECLARE @i TINYINT SET @i = 0 SELECT @strMsg = 'x' + CAST(@tblOrder_ID AS VARCHAR(8)) + 'x', @tblOrder_ID = tblOrder_fk_ID FROM tblOrder WHERE tblOrder_ID = @tblOrder_ID WHILE @tblOrder_ID <> 0 BEGIN SET @i = @i + 1 SELECT @strMsg = 'x' + CAST(tblOrder_ID AS VARCHAR(8)) + @strMsg, @tblOrder_ID = tblOrder_fk_ID FROM tblOrder WITH (NOLOCK) WHERE tblOrder_ID = @tblOrder_ID IF @i > 10 BREAK END RETURN (@strMsg) END GO >From: "Djabarov, Robert" >Reply-To: dba-sqlserver at databaseadvisors.com >To: >Subject: RE: [dba-SQLServer]Weird error message >Date: Wed, 4 Feb 2004 14:59:13 -0600 > >Can you post the function? > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy >Pang >Sent: Wednesday, February 04, 2004 1:32 PM >To: dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]Weird error message > > >Has anyone ever received the following error message before? It occurs >sporadicaly in my function but the funny thing is, I don't even have a >datetime var in my function. > >Server: Msg 542, Level 16, State 1, Procedure udf_show_this, Line 8 An >invalid datetime value was encountered. Value exceeds the year 9999. > >Thanks in advance, >Billy > >_________________________________________________________________ >MSN 8 with e-mail virus protection service: 2 months FREE* >http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2 >f >join.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca > >_______________________________________________ >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 > _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From tuxedo_man at hotmail.com Wed Feb 4 18:05:09 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Thu, 05 Feb 2004 00:05:09 +0000 Subject: [dba-SQLServer]Weird error message Message-ID: Just the created date field. That is it... no other datatime fields. >From: "Djabarov, Robert" >Reply-To: dba-sqlserver at databaseadvisors.com >To: >Subject: RE: [dba-SQLServer]Weird error message >Date: Wed, 4 Feb 2004 17:11:37 -0600 > >Are there any DATETIME fields in tblOrder table? It's obviously >data-related, but not necessarily is barking at the fields referenced in >the function. > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy >Pang >Sent: Wednesday, February 04, 2004 4:51 PM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer]Weird error message > > >CREATE FUNCTION udf_show_this (@tblOrder_ID INT) RETURNS VARCHAR(8000) >AS BEGIN > > DECLARE @strMsg VARCHAR(8000) > DECLARE @i TINYINT > SET @i = 0 > SELECT @strMsg = 'x' + CAST(@tblOrder_ID AS VARCHAR(8)) + 'x', >@tblOrder_ID = tblOrder_fk_ID FROM tblOrder WHERE tblOrder_ID = >@tblOrder_ID > > WHILE @tblOrder_ID <> 0 > BEGIN > SET @i = @i + 1 > SELECT @strMsg = 'x' + CAST(tblOrder_ID AS VARCHAR(8)) + >@strMsg, >@tblOrder_ID = tblOrder_fk_ID FROM tblOrder WITH (NOLOCK) WHERE >tblOrder_ID >= @tblOrder_ID > IF @i > 10 > BREAK > END > RETURN (@strMsg) >END > >GO > > > >From: "Djabarov, Robert" > >Reply-To: dba-sqlserver at databaseadvisors.com > >To: > >Subject: RE: [dba-SQLServer]Weird error message > >Date: Wed, 4 Feb 2004 14:59:13 -0600 > > > >Can you post the function? > > > >-----Original Message----- > >From: dba-sqlserver-bounces at databaseadvisors.com > >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Billy > >Pang > >Sent: Wednesday, February 04, 2004 1:32 PM > >To: dba-SQLServer at databaseadvisors.com > >Subject: [dba-SQLServer]Weird error message > > > > > >Has anyone ever received the following error message before? It occurs > > >sporadicaly in my function but the funny thing is, I don't even have a > >datetime var in my function. > > > >Server: Msg 542, Level 16, State 1, Procedure udf_show_this, Line 8 An > >invalid datetime value was encountered. Value exceeds the year 9999. > > > >Thanks in advance, > >Billy > > > >_________________________________________________________________ > >MSN 8 with e-mail virus protection service: 2 months FREE* > >http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2 > >f > >join.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca > > > >_______________________________________________ > >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 > > > >_________________________________________________________________ >Protect your PC - get McAfee.com VirusScan Online >http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > >_______________________________________________ >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 > _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca From my.lists at verizon.net Wed Feb 4 19:33:58 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Wed, 04 Feb 2004 17:33:58 -0800 Subject: [dba-SQLServer]cross database ownership? Message-ID: <40219D86.8060205@verizon.net> How the heck does this work... I'm very puzzled.. I have SQL2000 w/ SP3 and i'm realy grasping at straws right now as I can't seem to find the easiest solution for this... I have an NT group in a role who has rights to sprocs on my database, They have execute rights but no table rights... however the sproc looks for data which spans across 2 databases It does not make sense to me that I can't access the data in database 2 especially since cross database ownership is turned on, on both databases. the sproc is created by dbo, is there something else I need to do? SO in the mean time I've added the user into both databases and into roles by the same name.. db_myRole in db1 and db_myRole in db2 now I get an error stating that the user dosen't have select rights on db2... this shouldn't be.for testing I gave the role rights to the table and still nothing any ideas? am I using cross database ownership wrong? I'm about ready to yank the table into the first database. -- -Francisco From andrew.haslett at ilc.gov.au Wed Feb 4 20:19:06 2004 From: andrew.haslett at ilc.gov.au (Haslett, Andrew) Date: Thu, 5 Feb 2004 12:49:06 +1030 Subject: [dba-SQLServer]cross database ownership? Message-ID: Have you set up a linked server? Or using an adhoc connection? -----Original Message----- From: Francisco H Tapia [mailto:my.lists at verizon.net] Sent: Thursday, 5 February 2004 12:04 PM To: SQL Server 2k List; dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer]cross database ownership? How the heck does this work... I'm very puzzled.. I have SQL2000 w/ SP3 and i'm realy grasping at straws right now as I can't seem to find the easiest solution for this... I have an NT group in a role who has rights to sprocs on my database, They have execute rights but no table rights... however the sproc looks for data which spans across 2 databases It does not make sense to me that I can't access the data in database 2 especially since cross database ownership is turned on, on both databases. the sproc is created by dbo, is there something else I need to do? SO in the mean time I've added the user into both databases and into roles by the same name.. db_myRole in db1 and db_myRole in db2 now I get an error stating that the user dosen't have select rights on db2... this shouldn't be.for testing I gave the role rights to the table and still nothing any ideas? am I using cross database ownership wrong? I'm about ready to yank the table into the first database. -- -Francisco _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com IMPORTANT - PLEASE READ ******************** This email and any files transmitted with it are confidential and may contain information protected by law from disclosure. If you have received this message in error, please notify the sender immediately and delete this email from your system. No warranty is given that this email or files, if attached to this email, are free from computer viruses or other defects. They are provided on the basis the user assumes all responsibility for loss, damage or consequence resulting directly or indirectly from their use, whether caused by the negligence of the sender or not. From mikedorism at adelphia.net Thu Feb 5 06:25:41 2004 From: mikedorism at adelphia.net (Mike & Doris Manning) Date: Thu, 5 Feb 2004 07:25:41 -0500 Subject: [dba-SQLServer]cross database ownership? In-Reply-To: <40219D86.8060205@verizon.net> Message-ID: <000001c3ebe3$2be2c010$8b194244@hargrove.internal> I get around this by referencing the table in db2 from sprocs in db1. The syntax for referencing a table in another database is: Database.dbo.table The syntax for referencing a field in a table in another database is: Database.dbo.table.field Doris Manning Database Administrator Hargrove Inc. www.hargroveinc.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco H Tapia Sent: Wednesday, February 04, 2004 8:34 PM To: SQL Server 2k List; dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer]cross database ownership? How the heck does this work... I'm very puzzled.. I have SQL2000 w/ SP3 and i'm realy grasping at straws right now as I can't seem to find the easiest solution for this... I have an NT group in a role who has rights to sprocs on my database, They have execute rights but no table rights... however the sproc looks for data which spans across 2 databases It does not make sense to me that I can't access the data in database 2 especially since cross database ownership is turned on, on both databases. the sproc is created by dbo, is there something else I need to do? SO in the mean time I've added the user into both databases and into roles by the same name.. db_myRole in db1 and db_myRole in db2 now I get an error stating that the user dosen't have select rights on db2... this shouldn't be.for testing I gave the role rights to the table and still nothing any ideas? am I using cross database ownership wrong? I'm about ready to yank the table into the first database. -- -Francisco _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From my.lists at verizon.net Thu Feb 5 17:26:40 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Thu, 05 Feb 2004 15:26:40 -0800 Subject: [dba-SQLServer]cross database ownership? In-Reply-To: <000001c3ebe3$2be2c010$8b194244@hargrove.internal> References: <000001c3ebe3$2be2c010$8b194244@hargrove.internal> Message-ID: <4022D130.9010907@verizon.net> I have that but it still doesn't resolve when the user is only a member of one database it's not until I make them members of the 2nd database that it does it right. -- -Francisco Mike & Doris Manning wrote: >I get around this by referencing the table in db2 from sprocs in db1. > >The syntax for referencing a table in another database is: >Database.dbo.table > >The syntax for referencing a field in a table in another database is: >Database.dbo.table.field > > >Doris Manning >Database Administrator >Hargrove Inc. >www.hargroveinc.com > > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco H >Tapia >Sent: Wednesday, February 04, 2004 8:34 PM >To: SQL Server 2k List; dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]cross database ownership? > > >How the heck does this work... I'm very puzzled.. I have SQL2000 w/ SP3 >and i'm realy grasping at straws right now as I can't seem to find the >easiest solution for this... > > >I have an NT group in a role who has rights to sprocs on my database, >They have execute rights but no table rights... however the sproc looks >for data which spans across 2 databases > >It does not make sense to me that I can't access the data in database 2 >especially since cross database ownership is turned on, on both databases. > >the sproc is created by dbo, is there something else I need to do? SO >in the mean time I've added the user into both databases and into roles >by the same name.. db_myRole in db1 and db_myRole in db2 > >now I get an error stating that the user dosen't have select rights on >db2... this shouldn't be.for testing I gave the role rights to the table >and still nothing >any ideas? am I using cross database ownership wrong? I'm about ready >to yank the table into the first database. > > > From Robert.Djabarov at usaa.com Thu Feb 5 17:33:00 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Thu, 5 Feb 2004 17:33:00 -0600 Subject: [dba-SQLServer]cross database ownership? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3004341F19@ex02.eagle.usaa.com> This behavior is by design, otherwise users that are not present in 1 database could have access to it from another database. That would not be pretty :) -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco H Tapia Sent: Thursday, February 05, 2004 5:27 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer]cross database ownership? I have that but it still doesn't resolve when the user is only a member of one database it's not until I make them members of the 2nd database that it does it right. -- -Francisco Mike & Doris Manning wrote: >I get around this by referencing the table in db2 from sprocs in db1. > >The syntax for referencing a table in another database is: >Database.dbo.table > >The syntax for referencing a field in a table in another database is: >Database.dbo.table.field > > >Doris Manning >Database Administrator >Hargrove Inc. >www.hargroveinc.com > > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of >Francisco H Tapia >Sent: Wednesday, February 04, 2004 8:34 PM >To: SQL Server 2k List; dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]cross database ownership? > > >How the heck does this work... I'm very puzzled.. I have SQL2000 w/ SP3 >and i'm realy grasping at straws right now as I can't seem to find the >easiest solution for this... > > >I have an NT group in a role who has rights to sprocs on my database, >They have execute rights but no table rights... however the sproc looks >for data which spans across 2 databases > >It does not make sense to me that I can't access the data in database 2 >especially since cross database ownership is turned on, on both databases. > >the sproc is created by dbo, is there something else I need to do? SO >in the mean time I've added the user into both databases and into roles >by the same name.. db_myRole in db1 and db_myRole in db2 > >now I get an error stating that the user dosen't have select rights on >db2... this shouldn't be.for testing I gave the role rights to the table >and still nothing >any ideas? am I using cross database ownership wrong? I'm about ready >to yank the table into the first database. > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From my.lists at verizon.net Fri Feb 6 20:37:48 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Fri, 06 Feb 2004 18:37:48 -0800 Subject: [dba-SQLServer]cross database ownership? In-Reply-To: <3CCEA32DFF043C4CB99B835557E11B3004341F19@ex02.eagle.usaa.com> References: <3CCEA32DFF043C4CB99B835557E11B3004341F19@ex02.eagle.usaa.com> Message-ID: <40244F7C.80503@verizon.net> Granted... However it is generally BAD practice to give an enduser rights to tables... thus... if said user is in db1 and belongs to role1 and that role1 is given excute rights to sproc1 wich basically says Select field1, field2 from db1.dbo.table1 t1 inner join db2.dbo.table2 t2 ON t1.field1 = t2.field2 How can I make this work? both db1 and db2 have db chaining turned on, however it is still generating errors that my users dont have select rights in db2. should I make a view in db2 and give them select rights there, and join back via a view instead? thanks for any suggestions Djabarov, Robert wrote: > This behavior is by design, otherwise users that are not present in 1 > database could have access to it from another database. That would not > be pretty :) > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > Francisco H Tapia > Sent: Thursday, February 05, 2004 5:27 PM > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer]cross database ownership? > > > I have that but it still doesn't resolve when the user is only a member > of one database > it's not until I make them members of the 2nd database that it does it > right. > -- -Francisco From Robert.Djabarov at usaa.com Fri Feb 6 22:00:18 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Fri, 6 Feb 2004 22:00:18 -0600 Subject: [dba-SQLServer]cross database ownership? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECA6@ex02.eagle.usaa.com> It is also BAD practice to have a design that is not thought through so that the administration of the application becomes a nightmare or too cumbursome to support. Related things need to be kept together (IMHO) -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com on behalf of Francisco H Tapia Sent: Fri 2/6/2004 8:37 PM To: dba-sqlserver at databaseadvisors.com Cc: Subject: Re: [dba-SQLServer]cross database ownership? Granted... However it is generally BAD practice to give an enduser rights to tables... thus... if said user is in db1 and belongs to role1 and that role1 is given excute rights to sproc1 wich basically says Select field1, field2 from db1.dbo.table1 t1 inner join db2.dbo.table2 t2 ON t1.field1 = t2.field2 How can I make this work? both db1 and db2 have db chaining turned on, however it is still generating errors that my users dont have select rights in db2. should I make a view in db2 and give them select rights there, and join back via a view instead? thanks for any suggestions Djabarov, Robert wrote: > This behavior is by design, otherwise users that are not present in 1 > database could have access to it from another database. That would not > be pretty :) > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > Francisco H Tapia > Sent: Thursday, February 05, 2004 5:27 PM > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer]cross database ownership? > > > I have that but it still doesn't resolve when the user is only a member > of one database > it's not until I make them members of the 2nd database that it does it > right. > -- -Francisco _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From my.lists at verizon.net Sat Feb 7 03:05:20 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Sat, 07 Feb 2004 01:05:20 -0800 Subject: [dba-SQLServer]cross database ownership? In-Reply-To: <3CCEA32DFF043C4CB99B835557E11B3053ECA6@ex02.eagle.usaa.com> References: <3CCEA32DFF043C4CB99B835557E11B3053ECA6@ex02.eagle.usaa.com> Message-ID: <4024AA50.4090803@verizon.net> what in what My situation, I have an audit data that I thought would be useful in it's own database. Is this not the way to do it? keep the archived info seperate? or simply moving it to it's on filegroup? db1 = data db2 = archive I wanted to be able to exec a sproc in db1 but that doesn't seem like it's gonna happen, It seems I'll need to create the sproce for read and write in db2 and handle all rights there? -- -Francisco Djabarov, Robert wrote: > It is also BAD practice to have a design that is not thought through so that the administration of the application becomes a nightmare or too cumbursome to support. Related things need to be kept together (IMHO) > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com on behalf of Francisco H Tapia > Sent: Fri 2/6/2004 8:37 PM > To: dba-sqlserver at databaseadvisors.com > Cc: > Subject: Re: [dba-SQLServer]cross database ownership? > > > > Granted... > > However it is generally BAD practice to give an enduser rights to > tables... thus... if said user is in db1 and belongs to role1 and that > role1 is given excute rights to sproc1 wich basically says > > > Select field1, field2 from db1.dbo.table1 t1 inner join db2.dbo.table2 > t2 ON t1.field1 = t2.field2 > > How can I make this work? > > both db1 and db2 have db chaining turned on, however it is still > generating errors that my users dont have select rights in db2. > > should I make a view in db2 and give them select rights there, and join > back via a view instead? > > > thanks for any suggestions > > > Djabarov, Robert wrote: > > > This behavior is by design, otherwise users that are not present in 1 > > database could have access to it from another database. That would not > > be pretty :) > > > > -----Original Message----- > > From: dba-sqlserver-bounces at databaseadvisors.com > > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of > > Francisco H Tapia > > Sent: Thursday, February 05, 2004 5:27 PM > > To: dba-sqlserver at databaseadvisors.com > > Subject: Re: [dba-SQLServer]cross database ownership? > > > > > > I have that but it still doesn't resolve when the user is only a member > > of one database > > it's not until I make them members of the 2nd database that it does it > > right. > > > > > -- > -Francisco > > _______________________________________________ From listmaster at databaseadvisors.com Sun Feb 8 20:13:31 2004 From: listmaster at databaseadvisors.com (Bryan Carbonnell) Date: Sun, 08 Feb 2004 21:13:31 -0500 Subject: [dba-SQLServer]Administrivia - List Software Upgrade Message-ID: <4026A67B.1068.B05F0E@localhost> On Saturday February 14th, 2003 starting at 10:00 EST (15:00 UTC) the software that runs the lists hosted by Database Advisors will be upgraded. It should only take a couple of hours. This will bring our software upto date. Not only is it necessary for security but it will also be a step on the road to a completely searchable archive at http://databaseadvisors.com During the time it takes to run the upgrade, the server will be down. Any post made during this time will not be accepted. It may be rejected by the server as well. However, it will only be a temporary situation. A notice will be posted once the server is back up and running with the new list software. You can also keep an eye on http://www.databaseadvisors.com/liststatus.htm for any changes or notices. Thank you for your patience during this, and the upcoming changes and upgrades. Thank You, -- Bryan Carbonnell - Your Listmaster listmaster at databaseadvisors.com _______________________________________________ Administrivia mailing list Administrivia at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/administrivia From alan.lawhon at us.army.mil Mon Feb 9 16:31:07 2004 From: alan.lawhon at us.army.mil (Lawhon, Alan C Contractor/Morgan Research) Date: Mon, 9 Feb 2004 16:31:07 -0600 Subject: [dba-SQLServer] X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to S QL Server 2000 Message-ID: We upgraded our SQL Server 7.0 backend to SQL Server 2000 over the weekend. The front end runs Access 2000 GUI client applications. After the conversion, we are experiencing a problem with Access queries that select data from the [converted] back end SQL Server tables. The problem involves a hardcoded "-1" (i.e. "True" logic condition criteria) in the Access queries testing against a "Bit" data type field in the SQL Server back end. With the SQL Server 7.0 backend tables, the Access queries were working just fine. In converting to SQL Server 2000, it appears that previously populated bit fields populated with the value of "-1" ("True") got arbitrarily switched to a value of "1" during the conversion. (The "-1" values in the back end table ["Bit" fields] got changed, NOT the "-1" criteria value in the front end query cells!) Further, when the query runs against the [converted] back end table, the "-1" criteria (from the Access query) is no longer recognized - the query doesn't return data. Needless to say, we are no longer getting the expected results (from execution of the queries) after the conversion from SQL Server 7.0 to SQL Server 2000. I suspect that Microsoft implemented a change in the behaviour of "Bit" fields from version 7.0 to SQL Server 2000. While I search the Knowledge Base and try to track this down, can anybody confirm whether this is the case? We have a lot of queries (and VBA code) that test the "-1" value against fields of data type "Bit", so we don't want to start changing these hardcoded criteria (from "-1" to just plain "1") until and unless we are ABSOLUTELY SURE that this is a SQL Server version 7.0 to version 2000 conversion anomaly. TIA for any info or enlightenment on this problem. Alan C. Lawhon From ebarro at afsweb.com Mon Feb 9 16:47:30 2004 From: ebarro at afsweb.com (Eric Barro) Date: Mon, 9 Feb 2004 14:47:30 -0800 Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to SQL Server 2000 In-Reply-To: Message-ID: Yes SQL server uses 1 or 0 for bit fields. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Lawhon, Alan C Contractor/Morgan Research Sent: Monday, February 09, 2004 2:31 PM To: 'accessd at databaseadvisors.com' Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to SQL Server 2000 We upgraded our SQL Server 7.0 backend to SQL Server 2000 over the weekend. The front end runs Access 2000 GUI client applications. After the conversion, we are experiencing a problem with Access queries that select data from the [converted] back end SQL Server tables. The problem involves a hardcoded "-1" (i.e. "True" logic condition criteria) in the Access queries testing against a "Bit" data type field in the SQL Server back end. With the SQL Server 7.0 backend tables, the Access queries were working just fine. In converting to SQL Server 2000, it appears that previously populated bit fields populated with the value of "-1" ("True") got arbitrarily switched to a value of "1" during the conversion. (The "-1" values in the back end table ["Bit" fields] got changed, NOT the "-1" criteria value in the front end query cells!) Further, when the query runs against the [converted] back end table, the "-1" criteria (from the Access query) is no longer recognized - the query doesn't return data. Needless to say, we are no longer getting the expected results (from execution of the queries) after the conversion from SQL Server 7.0 to SQL Server 2000. I suspect that Microsoft implemented a change in the behaviour of "Bit" fields from version 7.0 to SQL Server 2000. While I search the Knowledge Base and try to track this down, can anybody confirm whether this is the case? We have a lot of queries (and VBA code) that test the "-1" value against fields of data type "Bit", so we don't want to start changing these hardcoded criteria (from "-1" to just plain "1") until and unless we are ABSOLUTELY SURE that this is a SQL Server version 7.0 to version 2000 conversion anomaly. TIA for any info or enlightenment on this problem. Alan C. Lawhon _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/2004 From Erwin.Craps at ithelps.be Tue Feb 10 01:38:37 2004 From: Erwin.Craps at ithelps.be (Erwin Craps - IT Helps) Date: Tue, 10 Feb 2004 08:38:37 +0100 Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQLServer 7.0 to SQL Server 2000 Message-ID: <46B976F2B698FF46A4FE7636509B22DF03D256@stekelbes.ithelps.local> Noticed that to. Don't know if there some general option to change that. It would seem logical that would be posible. Erwin -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Monday, February 09, 2004 11:48 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQLServer 7.0 to SQL Server 2000 Yes SQL server uses 1 or 0 for bit fields. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Lawhon, Alan C Contractor/Morgan Research Sent: Monday, February 09, 2004 2:31 PM To: 'accessd at databaseadvisors.com' Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to SQL Server 2000 We upgraded our SQL Server 7.0 backend to SQL Server 2000 over the weekend. The front end runs Access 2000 GUI client applications. After the conversion, we are experiencing a problem with Access queries that select data from the [converted] back end SQL Server tables. The problem involves a hardcoded "-1" (i.e. "True" logic condition criteria) in the Access queries testing against a "Bit" data type field in the SQL Server back end. With the SQL Server 7.0 backend tables, the Access queries were working just fine. In converting to SQL Server 2000, it appears that previously populated bit fields populated with the value of "-1" ("True") got arbitrarily switched to a value of "1" during the conversion. (The "-1" values in the back end table ["Bit" fields] got changed, NOT the "-1" criteria value in the front end query cells!) Further, when the query runs against the [converted] back end table, the "-1" criteria (from the Access query) is no longer recognized - the query doesn't return data. Needless to say, we are no longer getting the expected results (from execution of the queries) after the conversion from SQL Server 7.0 to SQL Server 2000. I suspect that Microsoft implemented a change in the behaviour of "Bit" fields from version 7.0 to SQL Server 2000. While I search the Knowledge Base and try to track this down, can anybody confirm whether this is the case? We have a lot of queries (and VBA code) that test the "-1" value against fields of data type "Bit", so we don't want to start changing these hardcoded criteria (from "-1" to just plain "1") until and unless we are ABSOLUTELY SURE that this is a SQL Server version 7.0 to version 2000 conversion anomaly. TIA for any info or enlightenment on this problem. Alan C. Lawhon _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/2004 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From andrew.haslett at ilc.gov.au Wed Feb 11 04:22:23 2004 From: andrew.haslett at ilc.gov.au (Haslett, Andrew) Date: Wed, 11 Feb 2004 20:52:23 +1030 Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to SQL Server 2000 Message-ID: There was an Access 2000 SQL Server 'Readiness Update' in early version of Office 2k. I believe it was included in a later service pack. This may or may not fix the issue, however it definitely fixed issues we had when upgrading an Access MDB to SQL Server. Check out Office Update for more info. Cheers, Andrew -----Original Message----- From: Lawhon, Alan C Contractor/Morgan Research [mailto:alan.lawhon at us.army.mil] Sent: Tuesday, 10 February 2004 9:01 AM To: 'accessd at databaseadvisors.com' Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]X-Posted: Problem Converting Bit Fields From SQL Server 7.0 to SQL Server 2000 We upgraded our SQL Server 7.0 backend to SQL Server 2000 over the weekend. The front end runs Access 2000 GUI client applications. After the conversion, we are experiencing a problem with Access queries that select data from the [converted] back end SQL Server tables. The problem involves a hardcoded "-1" (i.e. "True" logic condition criteria) in the Access queries testing against a "Bit" data type field in the SQL Server back end. With the SQL Server 7.0 backend tables, the Access queries were working just fine. In converting to SQL Server 2000, it appears that previously populated bit fields populated with the value of "-1" ("True") got arbitrarily switched to a value of "1" during the conversion. (The "-1" values in the back end table ["Bit" fields] got changed, NOT the "-1" criteria value in the front end query cells!) Further, when the query runs against the [converted] back end table, the "-1" criteria (from the Access query) is no longer recognized - the query doesn't return data. Needless to say, we are no longer getting the expected results (from execution of the queries) after the conversion from SQL Server 7.0 to SQL Server 2000. I suspect that Microsoft implemented a change in the behaviour of "Bit" fields from version 7.0 to SQL Server 2000. While I search the Knowledge Base and try to track this down, can anybody confirm whether this is the case? We have a lot of queries (and VBA code) that test the "-1" value against fields of data type "Bit", so we don't want to start changing these hardcoded criteria (from "-1" to just plain "1") until and unless we are ABSOLUTELY SURE that this is a SQL Server version 7.0 to version 2000 conversion anomaly. TIA for any info or enlightenment on this problem. Alan C. Lawhon _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com IMPORTANT - PLEASE READ ******************** This email and any files transmitted with it are confidential and may contain information protected by law from disclosure. If you have received this message in error, please notify the sender immediately and delete this email from your system. No warranty is given that this email or files, if attached to this email, are free from computer viruses or other defects. They are provided on the basis the user assumes all responsibility for loss, damage or consequence resulting directly or indirectly from their use, whether caused by the negligence of the sender or not. From my.lists at verizon.net Thu Feb 12 11:21:02 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Thu, 12 Feb 2004 09:21:02 -0800 Subject: [dba-SQLServer]MCDBA Message-ID: <402BB5FE.4050501@verizon.net> I'm looking into getting my Cert... I checked out MS' site and am left wondering which books are best for brushing up for these tests? Thanks, -- -Francisco From michael.broesdorf at web.de Thu Feb 12 12:44:17 2004 From: michael.broesdorf at web.de (=?us-ascii?Q?Michael_Brosdorf?=) Date: Thu, 12 Feb 2004 19:44:17 +0100 Subject: [dba-SQLServer]Array's in T-SQL? In-Reply-To: <402BB5FE.4050501@verizon.net> Message-ID: Hello, does T-SQL support arrays at all? There doesn't seem to be any info in books online about variable arrays. I want to pass an integer array to a user-defined function. Michael From Robert.Djabarov at usaa.com Thu Feb 12 12:54:23 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Thu, 12 Feb 2004 12:54:23 -0600 Subject: [dba-SQLServer]Array's in T-SQL? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C78B@ex02.eagle.usaa.com> You can pass it in the form of a string, separated by comma. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Brosdorf Sent: Thursday, February 12, 2004 12:44 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Array's in T-SQL? Hello, does T-SQL support arrays at all? There doesn't seem to be any info in books online about variable arrays. I want to pass an integer array to a user-defined function. Michael _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael.broesdorf at web.de Thu Feb 12 12:58:47 2004 From: michael.broesdorf at web.de (=?us-ascii?Q?Michael_Brosdorf?=) Date: Thu, 12 Feb 2004 19:58:47 +0100 Subject: AW: [dba-SQLServer]Array's in T-SQL? In-Reply-To: <3CCEA32DFF043C4CB99B835557E11B3003C6C78B@ex02.eagle.usaa.com> Message-ID: But then I'd have to separate it in the function, not to speak of internationalisation problems, when I have numbers with decimal places... Are there no arrays in T-SQL? -----Ursprungliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Djabarov, Robert Gesendet: Donnerstag, 12. Februar 2004 19:54 An: dba-sqlserver at databaseadvisors.com Betreff: RE: [dba-SQLServer]Array's in T-SQL? You can pass it in the form of a string, separated by comma. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Brosdorf Sent: Thursday, February 12, 2004 12:44 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Array's in T-SQL? Hello, does T-SQL support arrays at all? There doesn't seem to be any info in books online about variable arrays. I want to pass an integer array to a user-defined function. Michael _______________________________________________ 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 DMcAfee at haascnc.com Thu Feb 12 13:24:32 2004 From: DMcAfee at haascnc.com (David McAfee) Date: Thu, 12 Feb 2004 11:24:32 -0800 Subject: [dba-SQLServer]Array's in T-SQL? Message-ID: <657FB70438B7D311AF320090279C180106144073@EXCHMAIL> use a pipe fro your delimeter "|" :) -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Michael Brosdorf Sent: Thursday, February 12, 2004 10:59 AM To: dba-sqlserver at databaseadvisors.com Subject: AW: [dba-SQLServer]Array's in T-SQL? But then I'd have to separate it in the function, not to speak of internationalisation problems, when I have numbers with decimal places... Are there no arrays in T-SQL? -----Ursprungliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Djabarov, Robert Gesendet: Donnerstag, 12. Februar 2004 19:54 An: dba-sqlserver at databaseadvisors.com Betreff: RE: [dba-SQLServer]Array's in T-SQL? You can pass it in the form of a string, separated by comma. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Brosdorf Sent: Thursday, February 12, 2004 12:44 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Array's in T-SQL? Hello, does T-SQL support arrays at all? There doesn't seem to be any info in books online about variable arrays. I want to pass an integer array to a user-defined function. Michael _______________________________________________ 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 tuxedo_man at hotmail.com Thu Feb 12 14:32:06 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Thu, 12 Feb 2004 20:32:06 +0000 Subject: [dba-SQLServer]MCDBA Message-ID: I got my MCDBA little over a month ago. In studying for them, I bought all the official MS training kits for the exams. I also bought the "exam cram series" equivalent to those exams to supplement the training kit. HTH Billy >From: Francisco H Tapia >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-sqlserver at databaseadvisors.com >Subject: [dba-SQLServer]MCDBA >Date: Thu, 12 Feb 2004 09:21:02 -0800 > >I'm looking into getting my Cert... I checked out MS' site and am left >wondering which books are best for brushing up for these tests? > > >Thanks, > >-- >-Francisco > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca From michael.broesdorf at web.de Thu Feb 12 15:43:23 2004 From: michael.broesdorf at web.de (=?iso-8859-1?Q?Michael_Br=F6sdorf?=) Date: Thu, 12 Feb 2004 22:43:23 +0100 Subject: [dba-SQLServer]Is this possible? In-Reply-To: Message-ID: Hi, i would like to pass a table name and a field name to a stored procedure. The stored procedure has to create a cursor that fetches all records from the table and performs certain operations based on the content of the specified field. Something like this: Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare MyCursor cursor for select <@MyField> from <@MyTable> Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end The problem is of course that I cannot simply put the variables containg table and field name into the select statement of the cursor. Is there any way this can be done? Michael From DMcAfee at haascnc.com Thu Feb 12 16:02:38 2004 From: DMcAfee at haascnc.com (David McAfee) Date: Thu, 12 Feb 2004 14:02:38 -0800 Subject: [dba-SQLServer]Is this possible? Message-ID: <657FB70438B7D311AF320090279C18010614407D@EXCHMAIL> You can do it with dynamic SQL but its generally frowned upon as a possible security risk (you would have to trap the input parameters to prevent "--", "'" and other syntax) and not to mention that it is not compiled. Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MySQL as VARCHAR(3000) SET @MySQL = 'select ' + @MyField + ' from ' + @MyTable +' WHERE....' EXEC (@MySQL) -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Michael Br?sdorf Sent: Thursday, February 12, 2004 1:43 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Is this possible? Hi, i would like to pass a table name and a field name to a stored procedure. The stored procedure has to create a cursor that fetches all records from the table and performs certain operations based on the content of the specified field. Something like this: Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare MyCursor cursor for select <@MyField> from <@MyTable> Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end The problem is of course that I cannot simply put the variables containg table and field name into the select statement of the cursor. Is there any way this can be done? Michael _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Kenneth.Stoker at pnl.gov Thu Feb 12 17:40:14 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Thu, 12 Feb 2004 15:40:14 -0800 Subject: [dba-SQLServer]Is this possible? Message-ID: <249C1CB246997C48BB74963CCD361C1B07C971@pnlmse28.pnl.gov> I ran into this problem a couple months ago and found this statement right from BOL: "Variables can be used only in expressions, not in place of object names or keywords." Using what I did then, you could do something like this (not tested): Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare @sql as varchar(4000) SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable Declare MyCursor cursor for Exec sp_execsql @sql Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end Hope something like this works/helps you. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] Sent: Thursday, February 12, 2004 1:43 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Is this possible? Hi, i would like to pass a table name and a field name to a stored procedure. The stored procedure has to create a cursor that fetches all records from the table and performs certain operations based on the content of the specified field. Something like this: Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare MyCursor cursor for select <@MyField> from <@MyTable> Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end The problem is of course that I cannot simply put the variables containg table and field name into the select statement of the cursor. Is there any way this can be done? Michael _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael.broesdorf at web.de Fri Feb 13 02:23:11 2004 From: michael.broesdorf at web.de (=?iso-8859-1?Q?Michael_Br=F6sdorf?=) Date: Fri, 13 Feb 2004 09:23:11 +0100 Subject: AW: [dba-SQLServer]Is this possible? In-Reply-To: <249C1CB246997C48BB74963CCD361C1B07C971@pnlmse28.pnl.gov> Message-ID: This is exactly what I tried: ... set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 Declare curT1 cursor for exec sp_ExecuteSQL @nvchSQL ... Unfortunately it comes up with this error message: Server: Msg 156, Level 15, State 1, Line 15 Incorrect syntax near the keyword 'exec'. It would certainly be possible to put the whole thing in a sp_ExecuteSQL, but I would like to avoid that if there is any other way... Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Stoker, Kenneth E Gesendet: Freitag, 13. Februar 2004 00:40 An: dba-sqlserver at databaseadvisors.com Betreff: RE: [dba-SQLServer]Is this possible? I ran into this problem a couple months ago and found this statement right from BOL: "Variables can be used only in expressions, not in place of object names or keywords." Using what I did then, you could do something like this (not tested): Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare @sql as varchar(4000) SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable Declare MyCursor cursor for Exec sp_execsql @sql Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end Hope something like this works/helps you. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] Sent: Thursday, February 12, 2004 1:43 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Is this possible? Hi, i would like to pass a table name and a field name to a stored procedure. The stored procedure has to create a cursor that fetches all records from the table and performs certain operations based on the content of the specified field. Something like this: Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare MyCursor cursor for select <@MyField> from <@MyTable> Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end The problem is of course that I cannot simply put the variables containg table and field name into the select statement of the cursor. Is there any way this can be done? Michael _______________________________________________ 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 sgeller at cce.umn.edu Fri Feb 13 08:28:24 2004 From: sgeller at cce.umn.edu (Susan Geller) Date: Fri, 13 Feb 2004 08:28:24 -0600 Subject: [dba-SQLServer]Is this possible? Message-ID: Michael, I doubt this is it, but when I execute a sql statement at the end of sproc that I have built dynamically in the sproc, I don't use the 'sp_executesql'. My syntax looks like this: Exec (@nvchSQL) --Susan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Br?sdorf Sent: Friday, February 13, 2004 2:23 AM To: dba-sqlserver at databaseadvisors.com Subject: AW: [dba-SQLServer]Is this possible? This is exactly what I tried: ... set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 Declare curT1 cursor for exec sp_ExecuteSQL @nvchSQL ... Unfortunately it comes up with this error message: Server: Msg 156, Level 15, State 1, Line 15 Incorrect syntax near the keyword 'exec'. It would certainly be possible to put the whole thing in a sp_ExecuteSQL, but I would like to avoid that if there is any other way... Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Stoker, Kenneth E Gesendet: Freitag, 13. Februar 2004 00:40 An: dba-sqlserver at databaseadvisors.com Betreff: RE: [dba-SQLServer]Is this possible? I ran into this problem a couple months ago and found this statement right from BOL: "Variables can be used only in expressions, not in place of object names or keywords." Using what I did then, you could do something like this (not tested): Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare @sql as varchar(4000) SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable Declare MyCursor cursor for Exec sp_execsql @sql Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end Hope something like this works/helps you. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] Sent: Thursday, February 12, 2004 1:43 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer]Is this possible? Hi, i would like to pass a table name and a field name to a stored procedure. The stored procedure has to create a cursor that fetches all records from the table and performs certain operations based on the content of the specified field. Something like this: Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare MyCursor cursor for select <@MyField> from <@MyTable> Fetch next from MyCursor into @MyVar While @@Fetchstatus=0 begin ... Print @MyVar ... end The problem is of course that I cannot simply put the variables containg table and field name into the select statement of the cursor. Is there any way this can be done? Michael _______________________________________________ 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 my.lists at verizon.net Fri Feb 13 10:21:31 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Fri, 13 Feb 2004 08:21:31 -0800 Subject: AW: [dba-SQLServer]Is this possible? In-Reply-To: References: Message-ID: <402CF98B.3060804@verizon.net> Another reason for why dynamic sql is frowned upon is that if "endUsers" from some application will be running the sproc, then you'll need to assign select rights to the "table" instead of just execute rights on the sproc. and as susan mentioned in another message, drop the sp_ExecuteSQL -- -Francisco Michael Br?sdorf wrote: > This is exactly what I tried: > > ... > set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 > > > Declare curT1 cursor for > exec sp_ExecuteSQL @nvchSQL > > ... > > > Unfortunately it comes up with this error message: > > Server: Msg 156, Level 15, State 1, Line 15 > Incorrect syntax near the keyword 'exec'. > > > It would certainly be possible to put the whole thing in a sp_ExecuteSQL, > but I would like > to avoid that if there is any other way... > > Michael > > > > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Stoker, Kenneth E > Gesendet: Freitag, 13. Februar 2004 00:40 > An: dba-sqlserver at databaseadvisors.com > Betreff: RE: [dba-SQLServer]Is this possible? > > > I ran into this problem a couple months ago and found this statement right > from BOL: > > "Variables can be used only in expressions, not in place of object names or > keywords." > > Using what I did then, you could do something like this (not tested): > > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS > > Declare @MyVar as int > Declare @sql as varchar(4000) > > SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable > > Declare MyCursor cursor for > Exec sp_execsql @sql > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > Hope something like this works/helps you. > > > Ken Stoker > Technology Commercialization > Information Systems Administrator > PH: (509) 375-3758 > FAX: (509) 375-6731 > E-mail: Kenneth.Stoker at pnl.gov > > > -----Original Message----- > From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] > Sent: Thursday, February 12, 2004 1:43 PM > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer]Is this possible? > > > Hi, > > i would like to pass a table name and a field name to a stored procedure. > The stored procedure has to create a cursor that fetches all records from > the table and performs certain operations based on the content of the > specified field. > > Something like this: > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS > > Declare @MyVar as int > > Declare MyCursor cursor for > select <@MyField> from <@MyTable> > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > > The problem is of course that I cannot simply put the variables containg > table and field name into the select statement of the cursor. > > Is there any way this can be done? > > Michael > From michael.broesdorf at web.de Fri Feb 13 10:55:32 2004 From: michael.broesdorf at web.de (=?iso-8859-1?Q?Michael_Br=F6sdorf?=) Date: Fri, 13 Feb 2004 17:55:32 +0100 Subject: AW: AW: [dba-SQLServer]Is this possible? In-Reply-To: <402CF98B.3060804@verizon.net> Message-ID: Hi, the sproc will be called from a scheduled job on the server for certain maintenance tasks, so there is no user interaction at all. Replacing sp_ExecuteSql with Exec (@nvchSQL) didn't help either - same error message! Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Francisco H Tapia Gesendet: Freitag, 13. Februar 2004 17:22 An: dba-sqlserver at databaseadvisors.com Betreff: Re: AW: [dba-SQLServer]Is this possible? Another reason for why dynamic sql is frowned upon is that if "endUsers" from some application will be running the sproc, then you'll need to assign select rights to the "table" instead of just execute rights on the sproc. and as susan mentioned in another message, drop the sp_ExecuteSQL -- -Francisco Michael Br?sdorf wrote: > This is exactly what I tried: > > ... > set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 > > > Declare curT1 cursor for > exec sp_ExecuteSQL @nvchSQL > > ... > > > Unfortunately it comes up with this error message: > > Server: Msg 156, Level 15, State 1, Line 15 > Incorrect syntax near the keyword 'exec'. > > > It would certainly be possible to put the whole thing in a sp_ExecuteSQL, > but I would like > to avoid that if there is any other way... > > Michael > > > > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Stoker, Kenneth E > Gesendet: Freitag, 13. Februar 2004 00:40 > An: dba-sqlserver at databaseadvisors.com > Betreff: RE: [dba-SQLServer]Is this possible? > > > I ran into this problem a couple months ago and found this statement right > from BOL: > > "Variables can be used only in expressions, not in place of object names or > keywords." > > Using what I did then, you could do something like this (not tested): > > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS > > Declare @MyVar as int > Declare @sql as varchar(4000) > > SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable > > Declare MyCursor cursor for > Exec sp_execsql @sql > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > Hope something like this works/helps you. > > > Ken Stoker > Technology Commercialization > Information Systems Administrator > PH: (509) 375-3758 > FAX: (509) 375-6731 > E-mail: Kenneth.Stoker at pnl.gov > > > -----Original Message----- > From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] > Sent: Thursday, February 12, 2004 1:43 PM > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer]Is this possible? > > > Hi, > > i would like to pass a table name and a field name to a stored procedure. > The stored procedure has to create a cursor that fetches all records from > the table and performs certain operations based on the content of the > specified field. > > Something like this: > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS > > Declare @MyVar as int > > Declare MyCursor cursor for > select <@MyField> from <@MyTable> > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > > The problem is of course that I cannot simply put the variables containg > table and field name into the select statement of the cursor. > > Is there any way this can be done? > > Michael > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Kenneth.Stoker at pnl.gov Fri Feb 13 11:59:06 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Fri, 13 Feb 2004 09:59:06 -0800 Subject: AW: [dba-SQLServer]Is this possible? Message-ID: <249C1CB246997C48BB74963CCD361C1B07C973@pnlmse28.pnl.gov> Then your best option is to create temporary table, load the data into it, then populate your cursor with the data from the temp table. A potential problem with this is knowing for certain what the data type of @MyField is. Therefore, you can do a lookup on the system tables to get the data type information. Another problem I ran into was that it wouldn't allow me to create #MyTable, it must go out of scope or something. Someone else here can probably explain that. So I had to create and drop a local table MyTable. Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS Declare @MyVar as int Declare @sql as varchar(4000) Declare @datatype as varchar(50) set @datatype = (select st.name + '(' + cast(sc.length as varchar(10)) + ')' from sysobjects so inner join syscolumns sc on so.id = sc.id inner join systypes st on sc.xtype = st.xtype where so.name = @MyTable and sc.name = @MyField) print @datatype SET @sql = 'CREATE TABLE MyTable (MyField ' + @datatype + ')' print @sql EXEC (@sql) SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable INSERT INTO MyTable(MyField) EXEC (@sql) Declare MyCursor cursor for SELECT * FROM MyTable open MyCursor Fetch next from MyCursor into @MyVar While (@@Fetch_status=0) begin ... Print @MyVar ... Fetch next from MyCursor into @MyVar end deallocate MyCursor drop table MyTable Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] Sent: Friday, February 13, 2004 8:56 AM To: dba-sqlserver at databaseadvisors.com Subject: AW: AW: [dba-SQLServer]Is this possible? Hi, the sproc will be called from a scheduled job on the server for certain maintenance tasks, so there is no user interaction at all. Replacing sp_ExecuteSql with Exec (@nvchSQL) didn't help either - same error message! Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Francisco H Tapia Gesendet: Freitag, 13. Februar 2004 17:22 An: dba-sqlserver at databaseadvisors.com Betreff: Re: AW: [dba-SQLServer]Is this possible? Another reason for why dynamic sql is frowned upon is that if "endUsers" from some application will be running the sproc, then you'll need to assign select rights to the "table" instead of just execute rights on the sproc. and as susan mentioned in another message, drop the sp_ExecuteSQL -- -Francisco Michael Br?sdorf wrote: > This is exactly what I tried: > > ... > set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 > > > Declare curT1 cursor for > exec sp_ExecuteSQL @nvchSQL > > ... > > > Unfortunately it comes up with this error message: > > Server: Msg 156, Level 15, State 1, Line 15 > Incorrect syntax near the keyword 'exec'. > > > It would certainly be possible to put the whole thing in a > sp_ExecuteSQL, but I would like to avoid that if there is any other > way... > > Michael > > > > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Stoker, Kenneth E > Gesendet: Freitag, 13. Februar 2004 00:40 > An: dba-sqlserver at databaseadvisors.com > Betreff: RE: [dba-SQLServer]Is this possible? > > > I ran into this problem a couple months ago and found this statement > right from BOL: > > "Variables can be used only in expressions, not in place of object > names or > keywords." > > Using what I did then, you could do something like this (not tested): > > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) > AS > > Declare @MyVar as int > Declare @sql as varchar(4000) > > SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable > > Declare MyCursor cursor for > Exec sp_execsql @sql > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > Hope something like this works/helps you. > > > Ken Stoker > Technology Commercialization > Information Systems Administrator > PH: (509) 375-3758 > FAX: (509) 375-6731 > E-mail: Kenneth.Stoker at pnl.gov > > > -----Original Message----- > From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] > Sent: Thursday, February 12, 2004 1:43 PM > To: dba-sqlserver at databaseadvisors.com > Subject: [dba-SQLServer]Is this possible? > > > Hi, > > i would like to pass a table name and a field name to a stored > procedure. The stored procedure has to create a cursor that fetches > all records from the table and performs certain operations based on > the content of the specified field. > > Something like this: > > Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) > AS > > Declare @MyVar as int > > Declare MyCursor cursor for > select <@MyField> from <@MyTable> > > Fetch next from MyCursor into @MyVar > > While @@Fetchstatus=0 > begin > ... > Print @MyVar > ... > end > > > The problem is of course that I cannot simply put the variables > containg table and field name into the select statement of the cursor. > > Is there any way this can be done? > > Michael > _______________________________________________ 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 my.lists at verizon.net Fri Feb 13 12:06:22 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Fri, 13 Feb 2004 10:06:22 -0800 Subject: AW: AW: [dba-SQLServer]Is this possible? In-Reply-To: References: Message-ID: <402D121E.1040406@verizon.net> get rid of the cursor, why do you even have that?, dump the contents into a temp table and then select * from #tempTable for your cursor, it'll solve your headache. -- -Francisco Michael Br?sdorf wrote: > Hi, > > the sproc will be called from a scheduled job on the server for certain > maintenance tasks, so there is no user interaction at all. > > Replacing sp_ExecuteSql with Exec (@nvchSQL) didn't help either - same error > message! > > Michael > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Francisco H Tapia > Gesendet: Freitag, 13. Februar 2004 17:22 > An: dba-sqlserver at databaseadvisors.com > Betreff: Re: AW: [dba-SQLServer]Is this possible? > > > Another reason for why dynamic sql is frowned upon is that if "endUsers" > from some application will be running the sproc, then you'll need to > assign select rights to the "table" instead of just execute rights on > the sproc. > > and as susan mentioned in another message, drop the sp_ExecuteSQL > > > -- > -Francisco > > Michael Br?sdorf wrote: > >>This is exactly what I tried: >> >>... >>set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 >> >> >>Declare curT1 cursor for >>exec sp_ExecuteSQL @nvchSQL >> >>... >> >> >>Unfortunately it comes up with this error message: >> >>Server: Msg 156, Level 15, State 1, Line 15 >>Incorrect syntax near the keyword 'exec'. >> >> >>It would certainly be possible to put the whole thing in a sp_ExecuteSQL, >>but I would like >>to avoid that if there is any other way... >> >>Michael >> >> >> >> >>-----Urspr?ngliche Nachricht----- >>Von: dba-sqlserver-bounces at databaseadvisors.com >>[mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von >>Stoker, Kenneth E >>Gesendet: Freitag, 13. Februar 2004 00:40 >>An: dba-sqlserver at databaseadvisors.com >>Betreff: RE: [dba-SQLServer]Is this possible? >> >> >>I ran into this problem a couple months ago and found this statement right >>from BOL: >> >> "Variables can be used only in expressions, not in place of object names > > or > >>keywords." >> >>Using what I did then, you could do something like this (not tested): >> >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >>Declare @sql as varchar(4000) >> >>SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable >> >>Declare MyCursor cursor for >>Exec sp_execsql @sql >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >>Hope something like this works/helps you. >> >> >>Ken Stoker >>Technology Commercialization >>Information Systems Administrator >>PH: (509) 375-3758 >>FAX: (509) 375-6731 >>E-mail: Kenneth.Stoker at pnl.gov >> >> >>-----Original Message----- >>From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] >>Sent: Thursday, February 12, 2004 1:43 PM >>To: dba-sqlserver at databaseadvisors.com >>Subject: [dba-SQLServer]Is this possible? >> >> >>Hi, >> >>i would like to pass a table name and a field name to a stored procedure. >>The stored procedure has to create a cursor that fetches all records from >>the table and performs certain operations based on the content of the >>specified field. >> >>Something like this: >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >> >>Declare MyCursor cursor for >>select <@MyField> from <@MyTable> >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >> >>The problem is of course that I cannot simply put the variables containg >>table and field name into the select statement of the cursor. >> >>Is there any way this can be done? >> >>Michael >> > > > > From Kenneth.Stoker at pnl.gov Fri Feb 13 17:04:43 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Fri, 13 Feb 2004 15:04:43 -0800 Subject: [dba-SQLServer] Determine which database a sproc is being called from Message-ID: <249C1CB246997C48BB74963CCD361C1B014A049A@pnlmse28.pnl.gov> Is there a way for a sproc to determine which database it resides in when called? I would like to make a sproc I am build generic enough so that it can be implemented in any database within a server instance. Thanks for any help. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov From tuxedo_man at hotmail.com Fri Feb 13 18:22:56 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Sat, 14 Feb 2004 00:22:56 +0000 Subject: [dba-SQLServer]Determine which database a sproc is being called from Message-ID: well, there's db_name() but that only gets the current database you are in... >From: "Stoker, Kenneth E" >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]Determine which database a sproc is being called >from >Date: Fri, 13 Feb 2004 15:04:43 -0800 > >Is there a way for a sproc to determine which database it resides in >when called? I would like to make a sproc I am build generic enough so >that it can be implemented in any database within a server instance. > >Thanks for any help. > >Ken Stoker >Technology Commercialization >Information Systems Administrator >PH: (509) 375-3758 >FAX: (509) 375-6731 >E-mail: Kenneth.Stoker at pnl.gov > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From Kenneth.Stoker at pnl.gov Fri Feb 13 18:24:55 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Fri, 13 Feb 2004 16:24:55 -0800 Subject: [dba-SQLServer] Determine which database a sproc is being called from Message-ID: <249C1CB246997C48BB74963CCD361C1B014A049C@pnlmse28.pnl.gov> Finally figured it out. It was surprising to me that I couldn't find an easier way. If any of you know of a better way, I am all ears. SELECT DISTINCT mdb.name FROM sysfiles sf INNER JOIN master.dbo.sysaltfiles msf on sf.filename = msf.filename INNER JOIN master.dbo.sysdatabases mdb on msf.dbid = mdb.dbid Have a good Valentine's Weekend everyone. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Stoker, Kenneth E Sent: Friday, February 13, 2004 3:05 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer] Determine which database a sproc is being called from Is there a way for a sproc to determine which database it resides in when called? I would like to make a sproc I am build generic enough so that it can be implemented in any database within a server instance. Thanks for any help. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Kenneth.Stoker at pnl.gov Fri Feb 13 18:33:59 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Fri, 13 Feb 2004 16:33:59 -0800 Subject: [dba-SQLServer]Determine which database a sproc is being calledfrom Message-ID: <249C1CB246997C48BB74963CCD361C1B07C974@pnlmse28.pnl.gov> That is what I was looking for. That is better than the method I just came up with and sent back to the list. I had tried db_name and didn't work, obviously because I didn't use db_name(). The reason I needed this is because I built a couple of sprocs that add/remove accounts and add memberships to SQL roles based on information in a couple tables. Since my current production database for this only had one database on it, I didn't do any checking to see if the accounts being removed belonged to other databases. Now that we have put this in production, other systems have expressed possible interest, but only if the sprocs would review all databases on the system and only remove accounts from the server that didn't belong to any other databases. So, with the current database name, I can now go through the list of database users, excluding those from the current database, and remove only those that don't have access to other databases and no longer exist in the source table specifying who should have access. The source table is populated based on role structure within the Active Directory of our network. Anyway, thanks very much Billy. Cuts the number of lines of code down. Always like that. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Billy Pang [mailto:tuxedo_man at hotmail.com] Sent: Friday, February 13, 2004 4:23 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer]Determine which database a sproc is being calledfrom well, there's db_name() but that only gets the current database you are in... >From: "Stoker, Kenneth E" >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer]Determine which database a sproc is being >called >from >Date: Fri, 13 Feb 2004 15:04:43 -0800 > >Is there a way for a sproc to determine which database it resides in >when called? I would like to make a sproc I am build generic enough so >that it can be implemented in any database within a server instance. > >Thanks for any help. > >Ken Stoker >Technology Commercialization >Information Systems Administrator >PH: (509) 375-3758 >FAX: (509) 375-6731 >E-mail: Kenneth.Stoker at pnl.gov > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From michael.broesdorf at web.de Sat Feb 14 04:18:23 2004 From: michael.broesdorf at web.de (=?iso-8859-1?Q?Michael_Br=F6sdorf?=) Date: Sat, 14 Feb 2004 11:18:23 +0100 Subject: [dba-SQLServer]Is this possible? In-Reply-To: <402D121E.1040406@verizon.net> Message-ID: Thanks to all who responded to my question - this list is great! I was trying to create generic procedure that compares the contents of two tables. The table names, the name of the ID field, a list of field names to be compared and the name of a result tables would have been the parameters of that procedure. Simply joining the two tables with all field is no option, since that fails when a field is NULL in both tables. That's why I tried to use a cursor to loop all records of table1 and compare each field from the fieldlist and write a record in the result table if the fields are different. Since there seems no way to convert a variable to an object name or use dynamic SQL in cursors this task would take way too long to implement. Is there something readily available that does that? Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Francisco H Tapia Gesendet: Freitag, 13. Februar 2004 19:06 An: dba-sqlserver at databaseadvisors.com Betreff: Re: AW: AW: [dba-SQLServer]Is this possible? get rid of the cursor, why do you even have that?, dump the contents into a temp table and then select * from #tempTable for your cursor, it'll solve your headache. -- -Francisco Michael Br?sdorf wrote: > Hi, > > the sproc will be called from a scheduled job on the server for certain > maintenance tasks, so there is no user interaction at all. > > Replacing sp_ExecuteSql with Exec (@nvchSQL) didn't help either - same error > message! > > Michael > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Francisco H Tapia > Gesendet: Freitag, 13. Februar 2004 17:22 > An: dba-sqlserver at databaseadvisors.com > Betreff: Re: AW: [dba-SQLServer]Is this possible? > > > Another reason for why dynamic sql is frowned upon is that if "endUsers" > from some application will be running the sproc, then you'll need to > assign select rights to the "table" instead of just execute rights on > the sproc. > > and as susan mentioned in another message, drop the sp_ExecuteSQL > > > -- > -Francisco > > Michael Br?sdorf wrote: > >>This is exactly what I tried: >> >>... >>set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 >> >> >>Declare curT1 cursor for >>exec sp_ExecuteSQL @nvchSQL >> >>... >> >> >>Unfortunately it comes up with this error message: >> >>Server: Msg 156, Level 15, State 1, Line 15 >>Incorrect syntax near the keyword 'exec'. >> >> >>It would certainly be possible to put the whole thing in a sp_ExecuteSQL, >>but I would like >>to avoid that if there is any other way... >> >>Michael >> >> >> >> >>-----Urspr?ngliche Nachricht----- >>Von: dba-sqlserver-bounces at databaseadvisors.com >>[mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von >>Stoker, Kenneth E >>Gesendet: Freitag, 13. Februar 2004 00:40 >>An: dba-sqlserver at databaseadvisors.com >>Betreff: RE: [dba-SQLServer]Is this possible? >> >> >>I ran into this problem a couple months ago and found this statement right >>from BOL: >> >> "Variables can be used only in expressions, not in place of object names > > or > >>keywords." >> >>Using what I did then, you could do something like this (not tested): >> >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >>Declare @sql as varchar(4000) >> >>SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable >> >>Declare MyCursor cursor for >>Exec sp_execsql @sql >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >>Hope something like this works/helps you. >> >> >>Ken Stoker >>Technology Commercialization >>Information Systems Administrator >>PH: (509) 375-3758 >>FAX: (509) 375-6731 >>E-mail: Kenneth.Stoker at pnl.gov >> >> >>-----Original Message----- >>From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] >>Sent: Thursday, February 12, 2004 1:43 PM >>To: dba-sqlserver at databaseadvisors.com >>Subject: [dba-SQLServer]Is this possible? >> >> >>Hi, >> >>i would like to pass a table name and a field name to a stored procedure. >>The stored procedure has to create a cursor that fetches all records from >>the table and performs certain operations based on the content of the >>specified field. >> >>Something like this: >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >> >>Declare MyCursor cursor for >>select <@MyField> from <@MyTable> >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >> >>The problem is of course that I cannot simply put the variables containg >>table and field name into the select statement of the cursor. >> >>Is there any way this can be done? >> >>Michael >> > > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From listmaster at databaseadvisors.com Sat Feb 14 11:11:24 2004 From: listmaster at databaseadvisors.com (Bryan Carbonnell) Date: Sat, 14 Feb 2004 12:11:24 -0500 Subject: [dba-SQLServer] Administrivia - Software Updates Done Message-ID: <402E106C.13123.9EAD2F@localhost> Well folks, the stars and planets were all in alignment this morning and the list software upgrades went smoothly. Everything is back up and running. I will be tweaking as the day goes by, but you shouldn't notice anything. If you have any problems as a result of this upgrade, PLEASE let me know, listmaster at databaseadvisors.com. So why did we upgrade? Here are the highlights for those that are interested: - Several Security vulnerabilities - Bouncing rules have been updated - Hard Drive Usage improvements - Bounce Disable e-mail confirmation string expiry always out of date bug was fixed (This affected several members) - Archives takes time zome information into account when threading messages. These are the main reasons we upgraded. Thanks for your patience during the upgrade and if you encounter any problems, please let me know. -- Bryan Carbonnell - listmaster at databaseadvisors.com I've learned.... That one should keep his words both soft and tender, because tomorrow he may have to eat them. _______________________________________________ Administrivia mailing list Administrivia at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/administrivia From rl_stewart at highstream.net Sat Feb 14 16:29:52 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Sat, 14 Feb 2004 17:29:52 -0500 Subject: [dba-SQLServer] Ho To: Create a Stored Procedure using a parameter for IN In-Reply-To: <200402141810.i1EIALt13047@databaseadvisors.com> References: <200402141810.i1EIALt13047@databaseadvisors.com> Message-ID: <200402142229.i1EMTqpe031585@hsb102.xlccorp.com> Sometime I think I go brain dead. ;-) I am trying to do a stored procedure with a simple SQL statement like: SELECT ClientID, LastName, FirstName, ResidenceType FROM tblClient WHERE ResidenceType IN(@ResType) I need to be able to pass something like: house, hotel, homeless and get a list of people with that residency type. Nothing I have tried has worked. Can anyone give me some direction on doing this? Thanks, Robert L. Stewart The Dyson Group Expanding your sphere of Knowledge From paul.hartland at fsmail.net Mon Feb 16 03:03:27 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Mon, 16 Feb 2004 10:03:27 +0100 (CET) Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQL View Message-ID: <33430946.1076922207517.JavaMail.www@wwinf3002> To all, I have a table in SQL Server 7.0 called tblClient with the following fields of information: BranchNo BranchCode ClientName Addrs1 Addrs2 District Town County Postcode Telephone I want the following fields ClientName, Addrs1, Addrs2, District, Town, County, Postcode to appear as one line separated by a comma like below BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, District, Town, Postcode As you can se from the example Addrs2 and County are missing, this is because these are blank sometimes. I have tried a couple of ways but always end up with the following BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , Postcode As you can see where the missing fields are the comma?s still appear. Any help on this will be gratefully received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Mon Feb 16 03:03:27 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Mon, 16 Feb 2004 10:03:27 +0100 (CET) Subject: [dba-SQLServer] [dba-VB] Concatenating Fields In SQL Stored Procedure Or SQL View Message-ID: <33430946.1076922207517.JavaMail.www@wwinf3002> To all, I have a table in SQL Server 7.0 called tblClient with the following fields of information: BranchNo BranchCode ClientName Addrs1 Addrs2 District Town County Postcode Telephone I want the following fields ClientName, Addrs1, Addrs2, District, Town, County, Postcode to appear as one line separated by a comma like below BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, District, Town, Postcode As you can se from the example Addrs2 and County are missing, this is because these are blank sometimes. I have tried a couple of ways but always end up with the following BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , Postcode As you can see where the missing fields are the comma?s still appear. Any help on this will be gratefully received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Mon Feb 16 09:25:10 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Mon, 16 Feb 2004 09:25:10 -0600 Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQLView Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECB0@ex02.eagle.usaa.com> If the fields are NULL: Select BranchNo, BranchCode, Address = ClientName + Case Addrs1 when null then '' else ', ' + Addrs1 end + Case Addrs2 when null then '' else ', ' + Addrs2 end + Case District when null then '' else ', ' + District end + Case Town when null then '' else ', ' + Town end + Case County when null then '' else ', ' + County end + Case Postcode when null then '' else ', ' + Postcode + Case Telephone when null then '' else ', ' + Telephone From tblClient where ... If the fields are '' then: Select BranchNo, BranchCode, Address = ClientName + Case Addrs1 when '' then '' else ', ' + Addrs1 end + Case Addrs2 when '' then '' else ', ' + Addrs2 end + Case District when '' then '' else ', ' + District end + Case Town when '' then '' else ', ' + Town end + Case County when '' then '' else ', ' + County end + Case Postcode when '' then '' else ', ' + Postcode + Case Telephone when '' then '' else ', ' + Telephone From tblClient where ... Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Monday, February 16, 2004 3:03 AM To: SQL Group Cc: accessd; dba-vb Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQLView To all, I have a table in SQL Server 7.0 called tblClient with the following fields of information: BranchNo BranchCode ClientName Addrs1 Addrs2 District Town County Postcode Telephone I want the following fields ClientName, Addrs1, Addrs2, District, Town, County, Postcode to appear as one line separated by a comma like below BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, District, Town, Postcode As you can se from the example Addrs2 and County are missing, this is because these are blank sometimes. I have tried a couple of ways but always end up with the following BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , Postcode As you can see where the missing fields are the comma's still appear. Any help on this will be gratefully received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From paul.hartland at fsmail.net Mon Feb 16 09:32:51 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Mon, 16 Feb 2004 16:32:51 +0100 (CET) Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQLView Message-ID: <27373941.1076945571285.JavaMail.www@wwinf3001> Thanks Robert..... Message date : Feb 16 2004, 03:25 PM >From : "Djabarov, Robert" To : dba-sqlserver at databaseadvisors.com Copy to : Subject : RE: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQLView If the fields are NULL: Select BranchNo, BranchCode, Address = ClientName + Case Addrs1 when null then '' else ', ' + Addrs1 end + Case Addrs2 when null then '' else ', ' + Addrs2 end + Case District when null then '' else ', ' + District end + Case Town when null then '' else ', ' + Town end + Case County when null then '' else ', ' + County end + Case Postcode when null then '' else ', ' + Postcode + Case Telephone when null then '' else ', ' + Telephone >From tblClient where ... If the fields are '' then: Select BranchNo, BranchCode, Address = ClientName + Case Addrs1 when '' then '' else ', ' + Addrs1 end + Case Addrs2 when '' then '' else ', ' + Addrs2 end + Case District when '' then '' else ', ' + District end + Case Town when '' then '' else ', ' + Town end + Case County when '' then '' else ', ' + County end + Case Postcode when '' then '' else ', ' + Postcode + Case Telephone when '' then '' else ', ' + Telephone >From tblClient where ... Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Monday, February 16, 2004 3:03 AM To: SQL Group Cc: accessd; dba-vb Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQLView To all, I have a table in SQL Server 7.0 called tblClient with the following fields of information: BranchNo BranchCode ClientName Addrs1 Addrs2 District Town County Postcode Telephone I want the following fields ClientName, Addrs1, Addrs2, District, Town, County, Postcode to appear as one line separated by a comma like below BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, District, Town, Postcode As you can se from the example Addrs2 and County are missing, this is because these are blank sometimes. I have tried a couple of ways but always end up with the following BranchNo BranchCode Address 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , Postcode As you can see where the missing fields are the comma's still appear. Any help on this will be gratefully received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ 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 Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From Robert.Djabarov at usaa.com Mon Feb 16 09:39:11 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Mon, 16 Feb 2004 09:39:11 -0600 Subject: [dba-SQLServer] Ho To: Create a Stored Procedure using a parameterfor IN Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C791@ex02.eagle.usaa.com> Of course, you can do: Exec ('select ... from tblClient where ResidencyType in (' + @ResType + ')') But we all know what THIS means, right? I'd parse @ResType into a temptable, and then replace your WHERE clause with INNER JOIN on that table. Works like a charm every time :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Saturday, February 14, 2004 4:30 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Ho To: Create a Stored Procedure using a parameterfor IN Sometime I think I go brain dead. ;-) I am trying to do a stored procedure with a simple SQL statement like: SELECT ClientID, LastName, FirstName, ResidenceType FROM tblClient WHERE ResidenceType IN(@ResType) I need to be able to pass something like: house, hotel, homeless and get a list of people with that residency type. Nothing I have tried has worked. Can anyone give me some direction on doing this? Thanks, Robert L. Stewart The Dyson Group Expanding your sphere of Knowledge _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Mon Feb 16 09:41:55 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Mon, 16 Feb 2004 09:41:55 -0600 Subject: [dba-SQLServer] Administrivia - Software Updates Done Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C792@ex02.eagle.usaa.com> At least sounds like Monday morning starts up OK :) Thanks Bryan. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell Sent: Saturday, February 14, 2004 11:11 AM To: administrivia at databaseadvisors.com Subject: [dba-SQLServer] Administrivia - Software Updates Done Well folks, the stars and planets were all in alignment this morning and the list software upgrades went smoothly. Everything is back up and running. I will be tweaking as the day goes by, but you shouldn't notice anything. If you have any problems as a result of this upgrade, PLEASE let me know, listmaster at databaseadvisors.com. So why did we upgrade? Here are the highlights for those that are interested: - Several Security vulnerabilities - Bouncing rules have been updated - Hard Drive Usage improvements - Bounce Disable e-mail confirmation string expiry always out of date bug was fixed (This affected several members) - Archives takes time zome information into account when threading messages. These are the main reasons we upgraded. Thanks for your patience during the upgrade and if you encounter any problems, please let me know. -- Bryan Carbonnell - listmaster at databaseadvisors.com I've learned.... That one should keep his words both soft and tender, because tomorrow he may have to eat them. _______________________________________________ Administrivia mailing list Administrivia at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/administrivia _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Mon Feb 16 09:44:15 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Mon, 16 Feb 2004 09:44:15 -0600 Subject: [dba-SQLServer]Is this possible? Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C793@ex02.eagle.usaa.com> Check out SQL Data Compare from Red-Gate Software. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Michael Br?sdorf Sent: Saturday, February 14, 2004 4:18 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer]Is this possible? Thanks to all who responded to my question - this list is great! I was trying to create generic procedure that compares the contents of two tables. The table names, the name of the ID field, a list of field names to be compared and the name of a result tables would have been the parameters of that procedure. Simply joining the two tables with all field is no option, since that fails when a field is NULL in both tables. That's why I tried to use a cursor to loop all records of table1 and compare each field from the fieldlist and write a record in the result table if the fields are different. Since there seems no way to convert a variable to an object name or use dynamic SQL in cursors this task would take way too long to implement. Is there something readily available that does that? Michael -----Urspr?ngliche Nachricht----- Von: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von Francisco H Tapia Gesendet: Freitag, 13. Februar 2004 19:06 An: dba-sqlserver at databaseadvisors.com Betreff: Re: AW: AW: [dba-SQLServer]Is this possible? get rid of the cursor, why do you even have that?, dump the contents into a temp table and then select * from #tempTable for your cursor, it'll solve your headache. -- -Francisco Michael Br?sdorf wrote: > Hi, > > the sproc will be called from a scheduled job on the server for certain > maintenance tasks, so there is no user interaction at all. > > Replacing sp_ExecuteSql with Exec (@nvchSQL) didn't help either - same error > message! > > Michael > > -----Urspr?ngliche Nachricht----- > Von: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von > Francisco H Tapia > Gesendet: Freitag, 13. Februar 2004 17:22 > An: dba-sqlserver at databaseadvisors.com > Betreff: Re: AW: [dba-SQLServer]Is this possible? > > > Another reason for why dynamic sql is frowned upon is that if "endUsers" > from some application will be running the sproc, then you'll need to > assign select rights to the "table" instead of just execute rights on > the sproc. > > and as susan mentioned in another message, drop the sp_ExecuteSQL > > > -- > -Francisco > > Michael Br?sdorf wrote: > >>This is exactly what I tried: >> >>... >>set @nvchSQL='SELECT ' + @nvchIDField + 'AS MyID FROM ' + @nvchT1 >> >> >>Declare curT1 cursor for >>exec sp_ExecuteSQL @nvchSQL >> >>... >> >> >>Unfortunately it comes up with this error message: >> >>Server: Msg 156, Level 15, State 1, Line 15 >>Incorrect syntax near the keyword 'exec'. >> >> >>It would certainly be possible to put the whole thing in a sp_ExecuteSQL, >>but I would like >>to avoid that if there is any other way... >> >>Michael >> >> >> >> >>-----Urspr?ngliche Nachricht----- >>Von: dba-sqlserver-bounces at databaseadvisors.com >>[mailto:dba-sqlserver-bounces at databaseadvisors.com]Im Auftrag von >>Stoker, Kenneth E >>Gesendet: Freitag, 13. Februar 2004 00:40 >>An: dba-sqlserver at databaseadvisors.com >>Betreff: RE: [dba-SQLServer]Is this possible? >> >> >>I ran into this problem a couple months ago and found this statement right >>from BOL: >> >> "Variables can be used only in expressions, not in place of object names > > or > >>keywords." >> >>Using what I did then, you could do something like this (not tested): >> >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >>Declare @sql as varchar(4000) >> >>SET @sql = 'SELECT ' + @MyField + ' FROM ' + @MyTable >> >>Declare MyCursor cursor for >>Exec sp_execsql @sql >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >>Hope something like this works/helps you. >> >> >>Ken Stoker >>Technology Commercialization >>Information Systems Administrator >>PH: (509) 375-3758 >>FAX: (509) 375-6731 >>E-mail: Kenneth.Stoker at pnl.gov >> >> >>-----Original Message----- >>From: Michael Br?sdorf [mailto:michael.broesdorf at web.de] >>Sent: Thursday, February 12, 2004 1:43 PM >>To: dba-sqlserver at databaseadvisors.com >>Subject: [dba-SQLServer]Is this possible? >> >> >>Hi, >> >>i would like to pass a table name and a field name to a stored procedure. >>The stored procedure has to create a cursor that fetches all records from >>the table and performs certain operations based on the content of the >>specified field. >> >>Something like this: >> >>Create procedure MyProc @MyTable nvarchar(255), @MyField nvarchar(255) AS >> >>Declare @MyVar as int >> >>Declare MyCursor cursor for >>select <@MyField> from <@MyTable> >> >>Fetch next from MyCursor into @MyVar >> >>While @@Fetchstatus=0 >>begin >> ... >> Print @MyVar >> ... >>end >> >> >>The problem is of course that I cannot simply put the variables containg >>table and field name into the select statement of the cursor. >> >>Is there any way this can be done? >> >>Michael >> > > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Mon Feb 16 10:15:48 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Mon, 16 Feb 2004 10:15:48 -0600 Subject: [dba-SQLServer] Stored Procedure SQL IN Clause In-Reply-To: <200402160728.i1G7S4m29313@databaseadvisors.com> Message-ID: <5.1.0.14.2.20040216100141.029bc4a8@pop3.highstream.net> All, The end of last week, I was working on a stored procedure in SQL Server. I wanted it to be able to pass in information via a parameter to populate an IN clause in the SQL statement so I could use a multi-select list box for the control on the form. Here is what I was trying: I have a list of residence types (house, hotel, mobile home, homeless, etc.). I wanted to be able to select one or more in the list box. The Stored Procedure looked something like this: CREATE PROCEDURE uspResidenceTypeList @InClause Varchar(200) AS SELECT * FROM tblClient WHERE (ResidenceType IN(@InClause) This works for a single value, i.e. 'Homeless', but it returns no records when I pass in multiple values. Does someone have any ideas about what I can do to get this to work? Thanks, Robert Note Cross posted to dba-sqlserver at databaseadvisors.com From sgeller at cce.umn.edu Mon Feb 16 14:26:55 2004 From: sgeller at cce.umn.edu (Susan Geller) Date: Mon, 16 Feb 2004 14:26:55 -0600 Subject: [dba-SQLServer] Ho To: Create a Stored Procedure using aparameterfor IN Message-ID: Robert's second suggestion is definitely better for lots of reasons, but I often use the first suggestion anyway. A couple of things to remember when you use the "inferior" method -- any time you use a table in a dynamic select statement you need to grant select permission on the table to the users. Also, I've gotten stumped testing this in QA b/c the results panel will say successful, but there is no data. I put my sql string in a variable such as @sql_string varchar(1000) and then use "print @sql_string" in my sproc for testing. --Susan -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Djabarov, Robert Sent: Monday, February 16, 2004 9:39 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Ho To: Create a Stored Procedure using aparameterfor IN Of course, you can do: Exec ('select ... from tblClient where ResidencyType in (' + @ResType + ')') But we all know what THIS means, right? I'd parse @ResType into a temptable, and then replace your WHERE clause with INNER JOIN on that table. Works like a charm every time :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Saturday, February 14, 2004 4:30 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Ho To: Create a Stored Procedure using a parameterfor IN Sometime I think I go brain dead. ;-) I am trying to do a stored procedure with a simple SQL statement like: SELECT ClientID, LastName, FirstName, ResidenceType FROM tblClient WHERE ResidenceType IN(@ResType) I need to be able to pass something like: house, hotel, homeless and get a list of people with that residency type. Nothing I have tried has worked. Can anyone give me some direction on doing this? Thanks, Robert L. Stewart The Dyson Group Expanding your sphere of Knowledge _______________________________________________ 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 andrew.haslett at ilc.gov.au Mon Feb 16 15:27:56 2004 From: andrew.haslett at ilc.gov.au (Haslett, Andrew) Date: Tue, 17 Feb 2004 07:57:56 +1030 Subject: [dba-SQLServer] Stored Procedure SQL IN Clause Message-ID: Test it by manually inserting the same values into the WHERE clause to see if its returning any results. What format are you passing your criteria as? -----Original Message----- From: Robert L. Stewart [mailto:rl_stewart at highstream.net] Sent: Tuesday, 17 February 2004 2:46 AM To: accessd at databaseadvisors.com Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Stored Procedure SQL IN Clause All, The end of last week, I was working on a stored procedure in SQL Server. I wanted it to be able to pass in information via a parameter to populate an IN clause in the SQL statement so I could use a multi-select list box for the control on the form. Here is what I was trying: I have a list of residence types (house, hotel, mobile home, homeless, etc.). I wanted to be able to select one or more in the list box. The Stored Procedure looked something like this: CREATE PROCEDURE uspResidenceTypeList @InClause Varchar(200) AS SELECT * FROM tblClient WHERE (ResidenceType IN(@InClause) This works for a single value, i.e. 'Homeless', but it returns no records when I pass in multiple values. Does someone have any ideas about what I can do to get this to work? Thanks, Robert Note Cross posted to dba-sqlserver at databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com IMPORTANT - PLEASE READ ******************** This email and any files transmitted with it are confidential and may contain information protected by law from disclosure. If you have received this message in error, please notify the sender immediately and delete this email from your system. No warranty is given that this email or files, if attached to this email, are free from computer viruses or other defects. They are provided on the basis the user assumes all responsibility for loss, damage or consequence resulting directly or indirectly from their use, whether caused by the negligence of the sender or not. From knicholson at gpsx.net Mon Feb 16 15:30:33 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Mon, 16 Feb 2004 16:30:33 -0500 Subject: [dba-SQLServer] Stored Procedure SQL IN Clause Message-ID: Can you put in the percentage sign to include a longer string? The way you have it, the procedure will look for an exact match. CREATE PROCEDURE uspResidenceTypeList @InClause Varchar(200) AS SELECT * FROM tblClient WHERE (ResidenceType IN(@%InClause%) -----Original Message----- From: Haslett, Andrew [mailto:andrew.haslett at ilc.gov.au] Sent: Monday, February 16, 2004 4:28 PM To: 'dba-sqlserver at databaseadvisors.com' Subject: RE: [dba-SQLServer] Stored Procedure SQL IN Clause Test it by manually inserting the same values into the WHERE clause to see if its returning any results. What format are you passing your criteria as? -----Original Message----- From: Robert L. Stewart [mailto:rl_stewart at highstream.net] Sent: Tuesday, 17 February 2004 2:46 AM To: accessd at databaseadvisors.com Cc: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Stored Procedure SQL IN Clause All, The end of last week, I was working on a stored procedure in SQL Server. I wanted it to be able to pass in information via a parameter to populate an IN clause in the SQL statement so I could use a multi-select list box for the control on the form. Here is what I was trying: I have a list of residence types (house, hotel, mobile home, homeless, etc.). I wanted to be able to select one or more in the list box. The Stored Procedure looked something like this: CREATE PROCEDURE uspResidenceTypeList @InClause Varchar(200) AS SELECT * FROM tblClient WHERE (ResidenceType IN(@InClause) This works for a single value, i.e. 'Homeless', but it returns no records when I pass in multiple values. Does someone have any ideas about what I can do to get this to work? Thanks, Robert Note Cross posted to dba-sqlserver at databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com IMPORTANT - PLEASE READ ******************** This email and any files transmitted with it are confidential and may contain information protected by law from disclosure. If you have received this message in error, please notify the sender immediately and delete this email from your system. No warranty is given that this email or files, if attached to this email, are free from computer viruses or other defects. They are provided on the basis the user assumes all responsibility for loss, damage or consequence resulting directly or indirectly from their use, whether caused by the negligence of the sender or not. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From rl_stewart at highstream.net Mon Feb 16 15:53:51 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Mon, 16 Feb 2004 15:53:51 -0600 Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using a parameter for IN In-Reply-To: Message-ID: <5.1.0.14.2.20040216154441.029bb008@pop3.highstream.net> Final SQL Stored Procedure: CREATE PROCEDURE usp_Build_In @Select varchar(500), @From varchar(150), @Where varchar(500), @In varchar(500), @OrderBy Varchar(250) AS BEGIN DECLARE @SQL varchar(1900) SET @sql = @Select + @From + @Where + @In + @Orderby EXEC(@sql) END To Use it: SET QUOTED_IDENTIFIER OFF GO exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ', 'FROM tbl_Client ', 'WHERE LastName IN(', "'Stewart','Jones')", 'ORDER BY LastName' Notice the Double-quotes on the @In parameter. Robert, I am still working on the idea of using the subquery. The code you sent to me only returns one row, the last one in the list. But I will have more time to work with it tomorrow. RLS From stuart at lexacorp.com.pg Mon Feb 16 18:23:39 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 17 Feb 2004 10:23:39 +1000 Subject: [dba-SQLServer] Concatenating Fields In SQL Stored Procedure Or SQL View Message-ID: <4031EBAB.14760.13C55288@localhost> > I have a table in SQL Server 7.0 called tblClient with the following > fields of information: > BranchNo > BranchCode > ClientName > Addrs1 > Addrs2 > District > Town > County > Postcode > Telephone > > I want the following fields ClientName, Addrs1, Addrs2, District, Town, > County, Postcode to appear as one line separated by a comma like below > > BranchNo BranchCode Address > 9999029 B&Q9999029 ClientName, Addrs1, District, Town, > Postcode > > As you can se from the example Addrs2 and County are missing, this is > because these are blank sometimes. I have tried a couple of ways but > always end up with the following > > BranchNo BranchCode Address > 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , > Postcode > > As you can see where the missing fields are the comma?s still appear. Any > help on this will be gratefully received. It's a bit clumsy, but you could use: Select BranchNo, BranchCode, ClientName + ', ' + Addrs1 + ', ' + Case When Addrs2 > ' ' then Addrs2 + ',' Else '' End + District + "," + Town + "," + Case When County > ' ' then County + ',' Else '' End + Postcode from tblClient -- Stuart McLachlan Lexacorp Ltd Application Development, IT Consultancy http://www.lexacorp.com.pg From stuart at lexacorp.com.pg Mon Feb 16 18:23:39 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Tue, 17 Feb 2004 10:23:39 +1000 Subject: [dba-SQLServer] [dba-VB] Concatenating Fields In SQL Stored Procedure Or SQL View Message-ID: <4031EBAB.14760.13C55288@localhost> > I have a table in SQL Server 7.0 called tblClient with the following > fields of information: > BranchNo > BranchCode > ClientName > Addrs1 > Addrs2 > District > Town > County > Postcode > Telephone > > I want the following fields ClientName, Addrs1, Addrs2, District, Town, > County, Postcode to appear as one line separated by a comma like below > > BranchNo BranchCode Address > 9999029 B&Q9999029 ClientName, Addrs1, District, Town, > Postcode > > As you can se from the example Addrs2 and County are missing, this is > because these are blank sometimes. I have tried a couple of ways but > always end up with the following > > BranchNo BranchCode Address > 9999029 B&Q9999029 ClientName, Addrs1, , District, Town, , > Postcode > > As you can see where the missing fields are the comma?s still appear. Any > help on this will be gratefully received. It's a bit clumsy, but you could use: Select BranchNo, BranchCode, ClientName + ', ' + Addrs1 + ', ' + Case When Addrs2 > ' ' then Addrs2 + ',' Else '' End + District + "," + Town + "," + Case When County > ' ' then County + ',' Else '' End + Postcode from tblClient -- Stuart McLachlan Lexacorp Ltd Application Development, IT Consultancy http://www.lexacorp.com.pg _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From rl_stewart at highstream.net Mon Feb 16 22:31:55 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Mon, 16 Feb 2004 22:31:55 -0600 Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using a parameter for IN Message-ID: <5.1.0.14.2.20040216223131.01996358@pop3.highstream.net> Final SQL Stored Procedure: CREATE PROCEDURE usp_Build_In @Select varchar(500), @From varchar(150), @Where varchar(500), @In varchar(500), @OrderBy Varchar(250) AS BEGIN DECLARE @SQL varchar(1900) SET @sql = @Select + @From + @Where + @In + @Orderby EXEC(@sql) END To Use it: SET QUOTED_IDENTIFIER OFF GO exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ', 'FROM tbl_Client ', 'WHERE LastName IN(', "'Stewart','Jones')", 'ORDER BY LastName' Notice the Double-quotes on the @In parameter. Robert, I am still working on the idea of using the subquery. The code you sent to me only returns one row, the last one in the list. But I will have more time to work with it tomorrow. RLS From paul.hartland at fsmail.net Tue Feb 17 03:34:39 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 17 Feb 2004 10:34:39 +0100 (CET) Subject: [dba-SQLServer] Is This Possible ? Message-ID: <16329281.1077010479959.JavaMail.www@wwinf3002> To all, Firstly can I say a GREAT big thank you to those of you that helped me yesterday on concatenating fields in SQL Server 7.0. Your answers worked like a charm. Now this is where it gets complicated. Each member of our staff can be available for a full day, or half day (am/pm), so in our employee availability table we have three records like below (Type 0 = Full Day, 1=AM, 2 = PM): PayrollNo JobDate JobNo Type AvailCode 9999999 01/03/04 8726 0 A 9999999 01/03/04 1 A 9999999 01/03/04 2 A 9999999 02/03/04 0 A 9999999 02/03/04 7465 1 A 9999999 02/03/04 9372 2 A I need to somehow turn the above into the example below, If I need to use temporary tables etc I will but if the main calculations etc can be done by Stored Procedures then even better. Week Commencing PayrollNo Mon Tue Wed Thur Fri Sat Sun 01/03/04 9999999 8726 7465, 9372 08/03/04 15/03/04 22/03/04 I don?t really require the payrollno in the above example asa it will be shown elsewhere along with the Employees name. The main requirement of the above is that I will need to be able to edit the data. Anyone ever done anything like this before ?, all help greatly appreciated. Anything to get me pointing in the right direction . Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Tue Feb 17 03:34:39 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 17 Feb 2004 10:34:39 +0100 (CET) Subject: [dba-SQLServer] [dba-VB] Is This Possible ? Message-ID: <16329281.1077010479959.JavaMail.www@wwinf3002> To all, Firstly can I say a GREAT big thank you to those of you that helped me yesterday on concatenating fields in SQL Server 7.0. Your answers worked like a charm. Now this is where it gets complicated. Each member of our staff can be available for a full day, or half day (am/pm), so in our employee availability table we have three records like below (Type 0 = Full Day, 1=AM, 2 = PM): PayrollNo JobDate JobNo Type AvailCode 9999999 01/03/04 8726 0 A 9999999 01/03/04 1 A 9999999 01/03/04 2 A 9999999 02/03/04 0 A 9999999 02/03/04 7465 1 A 9999999 02/03/04 9372 2 A I need to somehow turn the above into the example below, If I need to use temporary tables etc I will but if the main calculations etc can be done by Stored Procedures then even better. Week Commencing PayrollNo Mon Tue Wed Thur Fri Sat Sun 01/03/04 9999999 8726 7465, 9372 08/03/04 15/03/04 22/03/04 I don?t really require the payrollno in the above example asa it will be shown elsewhere along with the Employees name. The main requirement of the above is that I will need to be able to edit the data. Anyone ever done anything like this before ?, all help greatly appreciated. Anything to get me pointing in the right direction . Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From paul.hartland at fsmail.net Tue Feb 17 04:58:59 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 17 Feb 2004 11:58:59 +0100 (CET) Subject: [dba-SQLServer] Week Commencing Table (SQL Server 7.0) Message-ID: <27579846.1077015539613.JavaMail.www@wwinf3002> To All, I am trying to write a stored procedure in SQL Server 7.0, that when I pass a startdate and enddate to it it will populate a week commencing table, I know how to pass parameters etc to a SQL Server stored procedure and I have also written other INSERT stored procedures, but how do I create a loop in a stored procedure so that startdate increments by 7 days and inserts the new week commencing date until enddate is reached. I was originally going to use Visual Basic to increment the dates then call the stored procedure each time the date incremented, but it would look a lot cleaner if I could achieve this in SQL Server itself. Can anyone point me in the right direction (Again) .. Thanks in advance for any help on this .. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Tue Feb 17 04:58:59 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 17 Feb 2004 11:58:59 +0100 (CET) Subject: [dba-SQLServer] [dba-VB] Week Commencing Table (SQL Server 7.0) Message-ID: <27579846.1077015539613.JavaMail.www@wwinf3002> To All, I am trying to write a stored procedure in SQL Server 7.0, that when I pass a startdate and enddate to it it will populate a week commencing table, I know how to pass parameters etc to a SQL Server stored procedure and I have also written other INSERT stored procedures, but how do I create a loop in a stored procedure so that startdate increments by 7 days and inserts the new week commencing date until enddate is reached. I was originally going to use Visual Basic to increment the dates then call the stored procedure each time the date incremented, but it would look a lot cleaner if I could achieve this in SQL Server itself. Can anyone point me in the right direction (Again) .. Thanks in advance for any help on this .. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Tue Feb 17 09:02:44 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Tue, 17 Feb 2004 09:02:44 -0600 Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using aparameter for IN Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECB3@ex02.eagle.usaa.com> OK, this HAS to work now. You can JOIN the resulting function call with any other table where values passed to the function can be found: use pubs GO if object_id('dbo.fn_ParseString2VarCharTable') is not null drop function dbo.fn_ParseString2VarCharTable GO create function dbo.fn_ParseString2VarCharTable ( @string varchar(8000) ) returns @tbl table ( RecordID int identity(1,1) not null primary key clustered, [String] varchar(8000) not null ) as begin declare @spos int, @pos int set @string = replace(replace(@string, ', ', ','), ' ,', ',') set @spos = 1 set @pos = 100 while (@pos) > 0 begin set @pos = charindex(',', @string, @spos) insert @tbl ([String]) select ltrim ( rtrim ( substring ( @string, @spos, case when (@pos - @spos) <= 0 then datalength(@string) + 1 else @pos end - @spos ) ) ) set @spos = @pos + 1 end return end GO declare @str varchar(8000) set @str = '' select @str = @str + au_lname + ',' from pubs.dbo.authors set @str = reverse(substring(reverse(@str), 2, 8000)) select f.RecordID, a.* from pubs.dbo.authors a inner join dbo.fn_ParseString2VarCharTable (@str) f on a.au_lname = f.[String] select * from dbo.fn_ParseString2VarCharTable ('this , is,a , test,and, as ,you, can , see,it ,works!') Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Monday, February 16, 2004 10:32 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using aparameter for IN Final SQL Stored Procedure: CREATE PROCEDURE usp_Build_In @Select varchar(500), @From varchar(150), @Where varchar(500), @In varchar(500), @OrderBy Varchar(250) AS BEGIN DECLARE @SQL varchar(1900) SET @sql = @Select + @From + @Where + @In + @Orderby EXEC(@sql) END To Use it: SET QUOTED_IDENTIFIER OFF GO exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ', 'FROM tbl_Client ', 'WHERE LastName IN(', "'Stewart','Jones')", 'ORDER BY LastName' Notice the Double-quotes on the @In parameter. Robert, I am still working on the idea of using the subquery. The code you sent to me only returns one row, the last one in the list. But I will have more time to work with it tomorrow. RLS _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From my.lists at verizon.net Wed Feb 18 15:06:16 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Wed, 18 Feb 2004 13:06:16 -0800 Subject: [dba-SQLServer] Rollback an MDAC installation Message-ID: <4033D3C8.8020603@verizon.net> This is why I never like to be on the bleeding edge anymore :(. I installed Mdac 2.8 on my workstation, but the server still has Mdac 2.7 SP1, whenever I run a transaction log backup from EM, I get disconnected... the backup still occurs (tho I've not tested them yet, I need to move them to my test server for that). if anyone know how to let me rollback my workstation to mdac 2.7sp1 please kindly post a url or hint or even a sentiment of dude!, don't tell me your using a Dell! ;o) Thanks, -- -Francisco From Robert.Djabarov at usaa.com Wed Feb 18 16:31:05 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 18 Feb 2004 16:31:05 -0600 Subject: [dba-SQLServer] Rollback an MDAC installation Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECB8@ex02.eagle.usaa.com> I learned it the hard way, just like you did - whenever you have Client Tools installed, the only way to control your MDAC level is through a service pack. In the mean time, check out these pages: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q232060 http://support.microsoft.com/default.aspx?scid=%2Fsupport%2Fmdac%2F26set upfaq%2Easp http://support.microsoft.com/default.aspx?scid=kb;en-us;Q307255 And check this one too: http://www.zuggsoft.com/data/ Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco H Tapia Sent: Wednesday, February 18, 2004 3:06 PM To: SQL Server 2k List; dba-sqlserver at databaseadvisors.com; hardware at hardwaregroup.com Subject: [dba-SQLServer] Rollback an MDAC installation This is why I never like to be on the bleeding edge anymore :(. I installed Mdac 2.8 on my workstation, but the server still has Mdac 2.7 SP1, whenever I run a transaction log backup from EM, I get disconnected... the backup still occurs (tho I've not tested them yet, I need to move them to my test server for that). if anyone know how to let me rollback my workstation to mdac 2.7sp1 please kindly post a url or hint or even a sentiment of dude!, don't tell me your using a Dell! ;o) Thanks, -- -Francisco _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Wed Feb 18 19:56:52 2004 From: artful at rogers.com (Arthur Fuller) Date: Wed, 18 Feb 2004 17:56:52 -0800 Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using aparameter for IN In-Reply-To: <5.1.0.14.2.20040216154441.029bb008@pop3.highstream.net> Message-ID: <007501c3f68b$a5f54eb0$6601a8c0@rock> IMO you permanently defeat the optimizations using this approach. Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert L. Stewart Sent: Monday, February 16, 2004 1:54 PM To: marion meh3 Cc: Robert.Djabarov at usaa.com; Eric Easley Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using aparameter for IN Final SQL Stored Procedure: CREATE PROCEDURE usp_Build_In @Select varchar(500), @From varchar(150), @Where varchar(500), @In varchar(500), @OrderBy Varchar(250) AS BEGIN DECLARE @SQL varchar(1900) SET @sql = @Select + @From + @Where + @In + @Orderby EXEC(@sql) END To Use it: SET QUOTED_IDENTIFIER OFF GO exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ', 'FROM tbl_Client ', 'WHERE LastName IN(', "'Stewart','Jones')", 'ORDER BY LastName' Notice the Double-quotes on the @In parameter. Robert, I am still working on the idea of using the subquery. The code you sent to me only returns one row, the last one in the list. But I will have more time to work with it tomorrow. RLS _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From my.lists at verizon.net Thu Feb 19 10:42:06 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Thu, 19 Feb 2004 08:42:06 -0800 Subject: [dba-SQLServer] Re: Rollback an MDAC installation In-Reply-To: References: Message-ID: <4034E75E.3080103@verizon.net> THANK YOU VERY MUCH!, this link had just the solution I needed. I can't believe how easy it was to rollback... I just tested EM and tried running a backup of the transaction log w/o problems... I pushed it to my test box and did the restore and all is well thanks again!!!!! a lesson well learned... wait until the mdac is freakin' tested never test on your workstation, that's what a testbox is for :D -- -Francisco Brian Hollister wrote: >Maybe this will help you out, > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html >/data_mdacinstall.asp > >Look for the Heading "MDAC Rollback" > > >Brian > >-----Original Message----- >From: bounce-sql2k-6393611 at ls.datareturn.com >[mailto:bounce-sql2k-6393611 at ls.datareturn.com] On Behalf Of Francisco H >Tapia >Sent: Wednesday, February 18, 2004 4:06 PM >To: SQL Server 2k List >Subject: Rollback an MDAC installation > >This is why I never like to be on the bleeding edge anymore :(. > >I installed Mdac 2.8 on my workstation, but the server still has Mdac >2.7 SP1, whenever I run a transaction log backup from EM, I get >disconnected... the backup still occurs (tho I've not tested them yet, I >need to move them to my test server for that). > >if anyone know how to let me rollback my workstation to mdac 2.7sp1 please >kindly post a url or hint or even a sentiment of dude!, don't tell me your >using a Dell! ;o) > >Thanks, > > > From MarkBoyd at McBeeAssociates.com Thu Feb 19 11:52:18 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Thu, 19 Feb 2004 12:52:18 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. From knicholson at gpsx.net Thu Feb 19 11:58:19 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Thu, 19 Feb 2004 12:58:19 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: In Access, under Tools Options, Edit Find, do you have the search set to default to ODBC? And someone else once told me on that same set frame, one should set the total number of records to read 0. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 12:52 PM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From knicholson at gpsx.net Thu Feb 19 12:01:11 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Thu, 19 Feb 2004 13:01:11 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: Also, make sure you only check one box on the filter by form defaults. The more you check the longer it takes to process. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 12:52 PM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Thu Feb 19 12:02:27 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Thu, 19 Feb 2004 12:02:27 -0600 Subject: [dba-SQLServer] Faster Searching Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C7B2@ex02.eagle.usaa.com> Replace a search against a linked table with a search either against a function or a stored procedure, using pass-through query. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Thursday, February 19, 2004 11:52 AM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From MarkBoyd at McBeeAssociates.com Thu Feb 19 12:07:12 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Thu, 19 Feb 2004 13:07:12 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: Thanks Karen. I tried all of your suggestions, but the search is still very, very slow. I noticed a checkbox on the Find and Replace dialog box that says 'Search Fields As Formatted'. By unchecking this, the search takes about 2 seconds. What does this checkbox mean? Mark -----Original Message----- From: Nicholson, Karen [mailto:knicholson at gpsx.net] Sent: Thursday, February 19, 2004 1:01 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Also, make sure you only check one box on the filter by form defaults. The more you check the longer it takes to process. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 12:52 PM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 knicholson at gpsx.net Thu Feb 19 12:19:13 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Thu, 19 Feb 2004 13:19:13 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: Right click on the button. It gives you a little blurb that if a date is formatted as Jan - 1 - 2000, this option would look for the J not the 1/1/2000. Notes that searching with as formatted is dreadfully slow. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 1:07 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Thanks Karen. I tried all of your suggestions, but the search is still very, very slow. I noticed a checkbox on the Find and Replace dialog box that says 'Search Fields As Formatted'. By unchecking this, the search takes about 2 seconds. What does this checkbox mean? Mark -----Original Message----- From: Nicholson, Karen [mailto:knicholson at gpsx.net] Sent: Thursday, February 19, 2004 1:01 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Also, make sure you only check one box on the filter by form defaults. The more you check the longer it takes to process. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 12:52 PM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 MarkBoyd at McBeeAssociates.com Thu Feb 19 12:48:14 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Thu, 19 Feb 2004 13:48:14 -0500 Subject: [dba-SQLServer] Faster Searching Message-ID: Great. Thanks again Karen. Mark -----Original Message----- From: Nicholson, Karen [mailto:knicholson at gpsx.net] Sent: Thursday, February 19, 2004 1:19 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Right click on the button. It gives you a little blurb that if a date is formatted as Jan - 1 - 2000, this option would look for the J not the 1/1/2000. Notes that searching with as formatted is dreadfully slow. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 1:07 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Thanks Karen. I tried all of your suggestions, but the search is still very, very slow. I noticed a checkbox on the Find and Replace dialog box that says 'Search Fields As Formatted'. By unchecking this, the search takes about 2 seconds. What does this checkbox mean? Mark -----Original Message----- From: Nicholson, Karen [mailto:knicholson at gpsx.net] Sent: Thursday, February 19, 2004 1:01 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Faster Searching Also, make sure you only check one box on the filter by form defaults. The more you check the longer it takes to process. -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Thursday, February 19, 2004 12:52 PM To: SQLServerList Subject: [dba-SQLServer] Faster Searching I have a SQL2000 table with about 5000 records. This table is linked to an Access DB. When I try to search records thru the form, it is taking about 5 minutes to find a record. I added an index to the field that is being used to search, but it didn't make a difference. Is there anything else I can do to speed up the Find process? TIA, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 rl_stewart at highstream.net Thu Feb 19 15:07:29 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Thu, 19 Feb 2004 15:07:29 -0600 Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using a parameter for IN In-Reply-To: <200402191800.i1JI0WU30249@databaseadvisors.com> Message-ID: <5.1.0.14.2.20040219150436.029f9008@pop3.highstream.net> Arthur, You are correct. That is why I am continuing with the information that the other Robert sent to me. I wanted something quick that I could use for an immediate need. The code that Robert sent to me seems to work well and will allow me to use a sub-query to make the process smoother and more efficient. Robert At 12:00 PM 2/19/2004 -0600, you wrote: >Date: Wed, 18 Feb 2004 17:56:52 -0800 >From: "Arthur Fuller" >Subject: RE: [dba-SQLServer] Re: How To: Create a Stored Procedure > using aparameter for IN >To: >Message-ID: <007501c3f68b$a5f54eb0$6601a8c0 at rock> >Content-Type: text/plain; charset="us-ascii" > >IMO you permanently defeat the optimizations using this approach. > >Arthur > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Robert >L. Stewart >Sent: Monday, February 16, 2004 1:54 PM >To: marion meh3 >Cc: Robert.Djabarov at usaa.com; Eric Easley >Subject: [dba-SQLServer] Re: How To: Create a Stored Procedure using >aparameter for IN > > >Final SQL Stored Procedure: > >CREATE PROCEDURE usp_Build_In > @Select varchar(500), > @From varchar(150), > @Where varchar(500), > @In varchar(500), > @OrderBy Varchar(250) >AS >BEGIN > DECLARE @SQL varchar(1900) > SET @sql = @Select + @From + @Where + @In + @Orderby > EXEC(@sql) >END > >To Use it: > >SET QUOTED_IDENTIFIER OFF >GO >exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ', > 'FROM tbl_Client ', > 'WHERE LastName IN(', > "'Stewart','Jones')", > 'ORDER BY LastName' > >Notice the Double-quotes on the @In parameter. > >Robert, I am still working on the idea of using the subquery. The code >you sent to me only returns one row, the last one in the list. But I >will have more time to work with it tomorrow. > >RLS From rl_stewart at highstream.net Thu Feb 19 15:12:21 2004 From: rl_stewart at highstream.net (Robert L. Stewart) Date: Thu, 19 Feb 2004 15:12:21 -0600 Subject: [dba-SQLServer] Re: Faster Searching In-Reply-To: <200402191800.i1JI0WU30249@databaseadvisors.com> Message-ID: <5.1.0.14.2.20040219150839.02a813a8@pop3.highstream.net> Mark, Something is wrong with the way you are searching. I have a 750,000+ record table that I do a search in using ODBC against SQL 2000 and it takes less that 2 seconds. I am using Like %something% in the criteria, so I am not even doing an exact search. The time went from about 20 seconds to less than 2 seconds after I indexed the column. Robert At 12:00 PM 2/19/2004 -0600, you wrote: >Date: Thu, 19 Feb 2004 12:52:18 -0500 >From: "Mark Boyd" >Subject: [dba-SQLServer] Faster Searching >To: "SQLServerList" >Message-ID: > >Content-Type: text/plain; charset="us-ascii" > >I have a SQL2000 table with about 5000 records. > >This table is linked to an Access DB. When I try to search records thru >the form, it is taking about 5 minutes to find a record. > >I added an index to the field that is being used to search, but it >didn't make a difference. > >Is there anything else I can do to speed up the Find process? > > > >TIA, > >Mark Boyd From carbonnb at sympatico.ca Thu Feb 19 21:01:49 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Thu, 19 Feb 2004 22:01:49 -0500 Subject: [dba-SQLServer] Test 1/2 Message-ID: <4035324D.32194.1193E41@localhost> Test 1 of 2. DO NOT REPLY!!! -- Bryan Carbonnell - carbonnb at sympatico.ca I'm not a complete idiot some parts are missing. From carbonnb at sympatico.ca Thu Feb 19 21:02:19 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Thu, 19 Feb 2004 22:02:19 -0500 Subject: [dba-SQLServer] Test 2/2/ Message-ID: <4035326B.14341.119B0F3@localhost> Test 2/2 DO NOT REPLY!!!! -- Bryan Carbonnell - carbonnb at sympatico.ca A good friend will come bail you out of jail.... but a true friend will be sitting next to you saying ^Damn... We ****ed up.^ From carbonnb at sympatico.ca Thu Feb 19 21:01:49 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Thu, 19 Feb 2004 22:01:49 -0500 Subject: [dba-SQLServer] [dba-VB] Test 1/2 Message-ID: <4035324D.32194.1193E41@localhost> Test 1 of 2. DO NOT REPLY!!! -- Bryan Carbonnell - carbonnb at sympatico.ca I'm not a complete idiot some parts are missing. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From carbonnb at sympatico.ca Thu Feb 19 21:02:19 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Thu, 19 Feb 2004 22:02:19 -0500 Subject: [dba-SQLServer] [dba-VB] Test 2/2/ Message-ID: <4035326B.14341.119B0F3@localhost> Test 2/2 DO NOT REPLY!!!! -- Bryan Carbonnell - carbonnb at sympatico.ca A good friend will come bail you out of jail.... but a true friend will be sitting next to you saying ^Damn... We ****ed up.^ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From davide at dalyn.co.nz Thu Feb 19 21:55:23 2004 From: davide at dalyn.co.nz (David Emerson) Date: Fri, 20 Feb 2004 16:55:23 +1300 Subject: [dba-SQLServer] DTS Message-ID: <5.2.0.9.0.20040220164624.00b2c730@mail.dalyn.co.nz> SQL 2000 Enterprise Manager I am putting together a DTS package that copies live data into my test database. I have a data transformation set up for the tables and all the data seems to copy over except the Identity field. Instead of copying the old contents it gives them new ID numbers. This is a problem because when I try to copy other tables that have relationships the ID's don't match. When I look at the transformations tab, and open the options for the field transformation the description shows "Copy the contents of the source data unchanged to the destination." (yet is isn't). Any clues as to why this problem (or better still a solution). Regards David Emerson Dalyn Software Ltd 25 Cunliffe St, Churton Park Wellington, New Zealand Ph/Fax (877) 456-1205 From davide at dalyn.co.nz Thu Feb 19 22:13:07 2004 From: davide at dalyn.co.nz (David Emerson) Date: Fri, 20 Feb 2004 17:13:07 +1300 Subject: [dba-SQLServer] DTS In-Reply-To: <5.2.0.9.0.20040220164624.00b2c730@mail.dalyn.co.nz> Message-ID: <5.2.0.9.0.20040220171242.00b9bdb8@mail.dalyn.co.nz> Found it: Options - Allow Identity Insert. David At 20/02/2004, you wrote: >SQL 2000 Enterprise Manager > >I am putting together a DTS package that copies live data into my test >database. I have a data transformation set up for the tables and all the >data seems to copy over except the Identity field. Instead of copying the >old contents it gives them new ID numbers. This is a problem because when >I try to copy other tables that have relationships the ID's don't match. > >When I look at the transformations tab, and open the options for the field >transformation the description shows "Copy the contents of the source data >unchanged to the destination." (yet is isn't). > >Any clues as to why this problem (or better still a solution). > >Regards > >David Emerson >Dalyn Software Ltd >25 Cunliffe St, Churton Park >Wellington, New Zealand >Ph/Fax (877) 456-1205 >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > > Regards David Emerson Dalyn Software Ltd 25 Cunliffe St, Churton Park Wellington, New Zealand Ph/Fax (877) 456-1205 From martyconnelly at shaw.ca Fri Feb 20 16:23:33 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 20 Feb 2004 14:23:33 -0800 Subject: [dba-SQLServer] TOAD for MS SQL References: <5.2.0.9.0.20040220171242.00b9bdb8@mail.dalyn.co.nz> Message-ID: <403688E5.1030800@shaw.ca> > For those of you who like TOAD for Oracle, there is now a version for MS SQL 2000 It appears to work for MSDE too. So might be handy for those without Enterprise Manager. http://www.toadsoft.com/toadss.html -- Marty Connelly Victoria, B.C. Canada From accessd at shaw.ca Fri Feb 20 20:15:58 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Fri, 20 Feb 2004 18:15:58 -0800 Subject: [dba-SQLServer] TOAD for MS SQL In-Reply-To: <403688E5.1030800@shaw.ca> Message-ID: Marty: Awesome... I really like TOAD...excellent package and so nice to see it come to SQL as well. Thanks for the heads up. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of MartyConnelly Sent: Friday, February 20, 2004 2:24 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] TOAD for MS SQL > For those of you who like TOAD for Oracle, there is now a version for MS SQL 2000 It appears to work for MSDE too. So might be handy for those without Enterprise Manager. http://www.toadsoft.com/toadss.html -- Marty Connelly Victoria, B.C. Canada _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From carbonnb at sympatico.ca Sat Feb 21 10:51:17 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Sat, 21 Feb 2004 11:51:17 -0500 Subject: [dba-SQLServer] Cross Posting Test Message-ID: <40374635.14782.C02296@localhost> Test. DO NOT REPLY!!! -- Bryan Carbonnell - carbonnb at sympatico.ca If you never fail, you're not trying hard enough. From djkr at msn.com Sat Feb 21 11:47:06 2004 From: djkr at msn.com (DJK(John) Robinson) Date: Sat, 21 Feb 2004 17:47:06 -0000 Subject: [dba-SQLServer] Thanks, Bryan In-Reply-To: <40374635.14782.C02296@localhost> Message-ID: <004001c3f8a2$b907c370$bf00a8c0@dabsight> Bryan Thanks for your work in analysing and solving the cross-posting problem. Those of us subscribed to more than one list will truly benefit! John From djkr at msn.com Sat Feb 21 11:47:06 2004 From: djkr at msn.com (DJK(John) Robinson) Date: Sat, 21 Feb 2004 17:47:06 -0000 Subject: [dba-SQLServer] [dba-VB] Thanks, Bryan In-Reply-To: <40374635.14782.C02296@localhost> Message-ID: <004001c3f8a2$b907c370$bf00a8c0@dabsight> Bryan Thanks for your work in analysing and solving the cross-posting problem. Those of us subscribed to more than one list will truly benefit! John _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From accessd at shaw.ca Sat Feb 21 17:16:16 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Sat, 21 Feb 2004 15:16:16 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: Message-ID: Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim From carbonnb at sympatico.ca Sun Feb 22 08:52:36 2004 From: carbonnb at sympatico.ca (Bryan Carbonnell) Date: Sun, 22 Feb 2004 09:52:36 -0500 Subject: [dba-SQLServer] Cross Post Test Again Message-ID: <40387BE4.2201.275C03@localhost> Cross Post Test Again. DO NOT REPLY. -- Bryan Carbonnell - carbonnb at sympatico.ca My reality check bounced. From davide at dalyn.co.nz Sun Feb 22 16:58:00 2004 From: davide at dalyn.co.nz (David Emerson) Date: Mon, 23 Feb 2004 11:58:00 +1300 Subject: [dba-SQLServer] Back up DTS local packages Message-ID: <5.2.0.9.0.20040223115649.00b2c458@mail.dalyn.co.nz> I can't seem to find a way to back up my packages in case I need to restore them, or if I want to copy them to another server. What is the best way to do this? Regards David Emerson Dalyn Software Ltd 25 Cunliffe St, Churton Park Wellington, New Zealand Ph/Fax (877) 456-1205 From artful at rogers.com Sun Feb 22 21:34:18 2004 From: artful at rogers.com (Arthur Fuller) Date: Sun, 22 Feb 2004 19:34:18 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: Message-ID: <021501c3f9bd$eca38360$6601a8c0@rock> I have never tested this so be advised that it's nothing more than a WAG, but you didn't mention the number of processors. The ONLY reason to run Advanced is multiple processors. I have a tired old dog server with twin P4-500s and it runs like quick! I have never tried to install Advanced on a single CPU unit because the docs clearly state that it's futile. Is it possible for you to back off Advanced and try the single-CPU version instead? Another thing to check is how much RAM each process is consuming, or prepared to consume. HTH, Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 3:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From artful at rogers.com Sun Feb 22 21:35:42 2004 From: artful at rogers.com (Arthur Fuller) Date: Sun, 22 Feb 2004 19:35:42 -0800 Subject: [dba-SQLServer] Back up DTS local packages In-Reply-To: <5.2.0.9.0.20040223115649.00b2c458@mail.dalyn.co.nz> Message-ID: <021601c3f9be$1e368da0$6601a8c0@rock> Insufficient info, David... Did you store them all as SQL objects? Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Emerson Sent: Sunday, February 22, 2004 2:58 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer] Back up DTS local packages I can't seem to find a way to back up my packages in case I need to restore them, or if I want to copy them to another server. What is the best way to do this? Regards David Emerson Dalyn Software Ltd 25 Cunliffe St, Churton Park Wellington, New Zealand Ph/Fax (877) 456-1205 _______________________________________________ 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 Sun Feb 22 19:10:52 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Sun, 22 Feb 2004 17:10:52 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <021501c3f9bd$eca38360$6601a8c0@rock> Message-ID: Hi Arthur: Thanks for your suggestion but the advanced model is what I purchased and I am loathe to change now. The other thing is that every other application that runs off this server is performing perfectly. Even MS SQL 2000 is, minus the performance, or lack of it. The RAM is not even being impacted so my thought that it might be a code segment is bleeding all over, is unfounded. You might be on to something, with SQL and W2000AdvSer...but where can I look. There is probably a simple setting somewhere in the registry. As all my new apps come from MS Action pack, I have passed my problem on MS and hope they have something. Thanks again Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Sunday, February 22, 2004 7:34 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance I have never tested this so be advised that it's nothing more than a WAG, but you didn't mention the number of processors. The ONLY reason to run Advanced is multiple processors. I have a tired old dog server with twin P4-500s and it runs like quick! I have never tried to install Advanced on a single CPU unit because the docs clearly state that it's futile. Is it possible for you to back off Advanced and try the single-CPU version instead? Another thing to check is how much RAM each process is consuming, or prepared to consume. HTH, Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 3:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ 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 davide at dalyn.co.nz Sun Feb 22 19:17:04 2004 From: davide at dalyn.co.nz (David Emerson) Date: Mon, 23 Feb 2004 14:17:04 +1300 Subject: [dba-SQLServer] Back up DTS local packages In-Reply-To: <021601c3f9be$1e368da0$6601a8c0@rock> References: <5.2.0.9.0.20040223115649.00b2c458@mail.dalyn.co.nz> Message-ID: <5.2.0.9.0.20040223141541.00b2c610@mail.dalyn.co.nz> Sorry. They are in the Data Transformation Services section under Local Packages. David At 22/02/2004, you wrote: >Insufficient info, David... Did you store them all as SQL objects? > >Arthur > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David >Emerson >Sent: Sunday, February 22, 2004 2:58 PM >To: dba-SQLServer at databaseadvisors.com >Subject: [dba-SQLServer] Back up DTS local packages > > >I can't seem to find a way to back up my packages in case I need to >restore >them, or if I want to copy them to another server. What is the best way >to >do this? > >Regards > >David Emerson >Dalyn Software Ltd >25 Cunliffe St, Churton Park >Wellington, New Zealand >Ph/Fax (877) 456-1205 From my.lists at verizon.net Mon Feb 23 10:42:59 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Mon, 23 Feb 2004 08:42:59 -0800 Subject: [dba-SQLServer] Back up DTS local packages In-Reply-To: <5.2.0.9.0.20040223141541.00b2c610@mail.dalyn.co.nz> References: <5.2.0.9.0.20040223115649.00b2c458@mail.dalyn.co.nz> <5.2.0.9.0.20040223141541.00b2c610@mail.dalyn.co.nz> Message-ID: <403A2D93.1000905@verizon.net> to backup up DTS packages make a backup of the msdb, if you are looking to also transfer them to some other server then take a look at DTS backup http://www.sqldts.com/default.aspx?6,105,242,0,0 note: you still have to do some editing because of location server name and such things... -- -Francisco David Emerson wrote: > Sorry. They are in the Data Transformation Services section under > Local Packages. > > David > > At 22/02/2004, you wrote: > >> Insufficient info, David... Did you store them all as SQL objects? >> >> Arthur >> >> -----Original Message----- >> From: dba-sqlserver-bounces at databaseadvisors.com >> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David >> Emerson >> Sent: Sunday, February 22, 2004 2:58 PM >> To: dba-SQLServer at databaseadvisors.com >> Subject: [dba-SQLServer] Back up DTS local packages >> >> >> I can't seem to find a way to back up my packages in case I need to >> restore >> them, or if I want to copy them to another server. What is the best way >> to >> do this? >> >> Regards >> >> David Emerson >> Dalyn Software Ltd >> 25 Cunliffe St, Churton Park >> Wellington, New Zealand >> Ph/Fax (877) 456-1205 > > > _______________________________________________ From davide at dalyn.co.nz Mon Feb 23 15:21:33 2004 From: davide at dalyn.co.nz (David Emerson) Date: Tue, 24 Feb 2004 10:21:33 +1300 Subject: [dba-SQLServer] Back up DTS local packages In-Reply-To: <403A2D93.1000905@verizon.net> References: <5.2.0.9.0.20040223141541.00b2c610@mail.dalyn.co.nz> <5.2.0.9.0.20040223115649.00b2c458@mail.dalyn.co.nz> <5.2.0.9.0.20040223141541.00b2c610@mail.dalyn.co.nz> Message-ID: <5.2.0.9.0.20040224102125.02d3e598@mail.dalyn.co.nz> Thanks. At 23/02/2004, you wrote: >to backup up DTS packages make a backup of the msdb, if you are looking to >also transfer them to some other server then take a look at DTS backup >http://www.sqldts.com/default.aspx?6,105,242,0,0 > >note: you still have to do some editing because of location server name >and such things... > >-- >-Francisco > > > >David Emerson wrote: > >>Sorry. They are in the Data Transformation Services section under Local >>Packages. >> >>David >> >>At 22/02/2004, you wrote: >> >>>Insufficient info, David... Did you store them all as SQL objects? >>> >>>Arthur >>> >>>-----Original Message----- >>>From: dba-sqlserver-bounces at databaseadvisors.com >>>[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David >>>Emerson >>>Sent: Sunday, February 22, 2004 2:58 PM >>>To: dba-SQLServer at databaseadvisors.com >>>Subject: [dba-SQLServer] Back up DTS local packages >>> >>> >>>I can't seem to find a way to back up my packages in case I need to >>>restore >>>them, or if I want to copy them to another server. What is the best way >>>to >>>do this? >>> >>>Regards >>> >>>David Emerson >>>Dalyn Software Ltd >>>25 Cunliffe St, Churton Park >>>Wellington, New Zealand >>>Ph/Fax (877) 456-1205 >> >> >>_______________________________________________ > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com > > From artful at rogers.com Tue Feb 24 11:41:11 2004 From: artful at rogers.com (Arthur Fuller) Date: Tue, 24 Feb 2004 09:41:11 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: Message-ID: <000001c3fafd$6fb13460$6501a8c0@rock> Well, since you are loathe to give up Advanced Server, what are the chances of you dropping in another CPU of equivalent specs? Second, with only one CPU this is a helluva load to put on a single server. Third, does Query Analyzer run as slowly as your app? (Do some selects etc. from QA to see.) Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Sunday, February 22, 2004 5:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Hi Arthur: Thanks for your suggestion but the advanced model is what I purchased and I am loathe to change now. The other thing is that every other application that runs off this server is performing perfectly. Even MS SQL 2000 is, minus the performance, or lack of it. The RAM is not even being impacted so my thought that it might be a code segment is bleeding all over, is unfounded. You might be on to something, with SQL and W2000AdvSer...but where can I look. There is probably a simple setting somewhere in the registry. As all my new apps come from MS Action pack, I have passed my problem on MS and hope they have something. Thanks again Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Sunday, February 22, 2004 7:34 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance I have never tested this so be advised that it's nothing more than a WAG, but you didn't mention the number of processors. The ONLY reason to run Advanced is multiple processors. I have a tired old dog server with twin P4-500s and it runs like quick! I have never tried to install Advanced on a single CPU unit because the docs clearly state that it's futile. Is it possible for you to back off Advanced and try the single-CPU version instead? Another thing to check is how much RAM each process is consuming, or prepared to consume. HTH, Arthur From Robert.Djabarov at usaa.com Tue Feb 24 10:02:23 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Tue, 24 Feb 2004 10:02:23 -0600 Subject: [dba-SQLServer] SQL Performance Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C7BE@ex02.eagle.usaa.com> You can also try to load Oracle and DB2 on it, then see who's slower :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 5:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Tue Feb 24 10:06:13 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Tue, 24 Feb 2004 10:06:13 -0600 Subject: [dba-SQLServer] Back up DTS local packages Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C7BF@ex02.eagle.usaa.com> http://www.sqldts.com/redir.aspx?1242 Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David Emerson Sent: Sunday, February 22, 2004 4:58 PM To: dba-SQLServer at databaseadvisors.com Subject: [dba-SQLServer] Back up DTS local packages I can't seem to find a way to back up my packages in case I need to restore them, or if I want to copy them to another server. What is the best way to do this? Regards David Emerson Dalyn Software Ltd 25 Cunliffe St, Churton Park Wellington, New Zealand Ph/Fax (877) 456-1205 _______________________________________________ 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 Tue Feb 24 19:44:16 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Tue, 24 Feb 2004 17:44:16 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <3CCEA32DFF043C4CB99B835557E11B3003C6C7BE@ex02.eagle.usaa.com> Message-ID: Hi Robert: Thanks for the comments...An example of how slow we are talking about is 6.5 minutes just to display the list of tables from Master DB. Oracle may be slow but not that slow... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Djabarov, Robert Sent: Tuesday, February 24, 2004 8:02 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance You can also try to load Oracle and DB2 on it, then see who's slower :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 5:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ 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 Tue Feb 24 19:54:20 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Tue, 24 Feb 2004 17:54:20 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <000001c3fafd$6fb13460$6501a8c0@rock> Message-ID: Hi Arthur: At one time, about couple years ago, when I first installed SQL2000, it ran on the computer as it was suppose to...very fast. There has been no other applications added, as I always try to keep a server fairly clean. At one point MSSQL started running slower and slower. The product was one given to me by a tech-salesman from MS and he said there was no time-out on it. When MSSQL started to slow down, I assumed it was timing out and removed it. Now, I have installed a brand-new developers edition, of MSSQL 2000 and it is already running super slow. This has me totally buffed as there has been no hardware and few software chances in a couple of years. Every application works correctly, including MSSQL, no errors of any kind...logs are clean; but.... Any insight would be greatly appreciated. TIA Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Tuesday, February 24, 2004 9:41 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Well, since you are loathe to give up Advanced Server, what are the chances of you dropping in another CPU of equivalent specs? Second, with only one CPU this is a helluva load to put on a single server. Third, does Query Analyzer run as slowly as your app? (Do some selects etc. from QA to see.) Arthur -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Sunday, February 22, 2004 5:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Hi Arthur: Thanks for your suggestion but the advanced model is what I purchased and I am loathe to change now. The other thing is that every other application that runs off this server is performing perfectly. Even MS SQL 2000 is, minus the performance, or lack of it. The RAM is not even being impacted so my thought that it might be a code segment is bleeding all over, is unfounded. You might be on to something, with SQL and W2000AdvSer...but where can I look. There is probably a simple setting somewhere in the registry. As all my new apps come from MS Action pack, I have passed my problem on MS and hope they have something. Thanks again Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Sunday, February 22, 2004 7:34 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance I have never tested this so be advised that it's nothing more than a WAG, but you didn't mention the number of processors. The ONLY reason to run Advanced is multiple processors. I have a tired old dog server with twin P4-500s and it runs like quick! I have never tried to install Advanced on a single CPU unit because the docs clearly state that it's futile. Is it possible for you to back off Advanced and try the single-CPU version instead? Another thing to check is how much RAM each process is consuming, or prepared to consume. HTH, Arthur _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From tuxedo_man at hotmail.com Tue Feb 24 22:42:16 2004 From: tuxedo_man at hotmail.com (Billy Pang) Date: Wed, 25 Feb 2004 04:42:16 +0000 Subject: [dba-SQLServer] SQL Performance Message-ID: Just a shot in the dark. Disable all server protocols. Restart sql server service. Turn on profiler and monitor any thing that goes on. HTH Billy >From: "Jim Lawrence (AccessD)" >Reply-To: dba-sqlserver at databaseadvisors.com >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance >Date: Tue, 24 Feb 2004 17:54:20 -0800 > >Hi Arthur: > >At one time, about couple years ago, when I first installed SQL2000, it ran >on the computer as it was suppose to...very fast. There has been no other >applications added, as I always try to keep a server fairly clean. At one >point MSSQL started running slower and slower. The product was one given to >me by a tech-salesman from MS and he said there was no time-out on it. When >MSSQL started to slow down, I assumed it was timing out and removed it. > >Now, I have installed a brand-new developers edition, of MSSQL 2000 and it >is already running super slow. This has me totally buffed as there has been >no hardware and few software chances in a couple of years. > >Every application works correctly, including MSSQL, no errors of any >kind...logs are clean; but.... > >Any insight would be greatly appreciated. >TIA >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur >Fuller >Sent: Tuesday, February 24, 2004 9:41 AM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >Well, since you are loathe to give up Advanced Server, what are the >chances of you dropping in another CPU of equivalent specs? Second, with >only one CPU this is a helluva load to put on a single server. Third, >does Query Analyzer run as slowly as your app? (Do some selects etc. >from QA to see.) > >Arthur > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim >Lawrence (AccessD) >Sent: Sunday, February 22, 2004 5:11 PM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >Hi Arthur: > >Thanks for your suggestion but the advanced model is what I purchased >and I am loathe to change now. The other thing is that every other >application that runs off this server is performing perfectly. Even MS >SQL 2000 is, minus the performance, or lack of it. The RAM is not even >being impacted so my thought that it might be a code segment is bleeding >all over, is unfounded. You might be on to something, with SQL and >W2000AdvSer...but where can I look. There is probably a simple setting >somewhere in the registry. > >As all my new apps come from MS Action pack, I have passed my problem on >MS and hope they have something. > >Thanks again >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Arthur >Fuller >Sent: Sunday, February 22, 2004 7:34 PM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >I have never tested this so be advised that it's nothing more than a >WAG, but you didn't mention the number of processors. The ONLY reason to >run Advanced is multiple processors. I have a tired old dog server with >twin P4-500s and it runs like quick! I have never tried to install >Advanced on a single CPU unit because the docs clearly state that it's >futile. Is it possible for you to back off Advanced and try the >single-CPU version instead? > >Another thing to check is how much RAM each process is consuming, or >prepared to consume. > >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 > _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca From Robert.Djabarov at usaa.com Wed Feb 25 08:36:22 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 25 Feb 2004 08:36:22 -0600 Subject: [dba-SQLServer] SQL Performance Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECBD@ex02.eagle.usaa.com> Jim, The remark I made was really derogatory, because I think you already have quite a bit on this box. In addition, you need to make sure you apply SP3 to your SQL install. If the problem persists, follow the rule of thumb, -there are 3 things that can cause such slow performance, - CPU, memory, or IO subsystem. The easiest way to see if the first 2 are an issue is to open task manager and select Processes tab. Click on CPU column header a couple of times and see what process other than System Idle Process may be taking all the CPU. Do the same with Memory column. I did observe performance degradation on my laptop (2.6GHz, 1GB memory, 120GB HD) with default and named instances of Personal edition, and managed to fix it by defragmenting the program files and data and log devices of master databases on both instances. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Tuesday, February 24, 2004 7:44 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Hi Robert: Thanks for the comments...An example of how slow we are talking about is 6.5 minutes just to display the list of tables from Master DB. Oracle may be slow but not that slow... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Djabarov, Robert Sent: Tuesday, February 24, 2004 8:02 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance You can also try to load Oracle and DB2 on it, then see who's slower :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 5:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ 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 my.lists at verizon.net Wed Feb 25 10:53:24 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Wed, 25 Feb 2004 08:53:24 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: References: Message-ID: <403CD304.7020105@verizon.net> How much ram did you allocate to SQL Server? If you open EM, and right click on your registered server, you will have a tab for the memory configuration, is it set to fixed, or dynamic, and if dynamic what is the maximum range? Jim Lawrence (AccessD) wrote: >Hi Robert: > >Thanks for the comments...An example of how slow we are talking about is 6.5 >minutes just to display the list of tables from Master DB. Oracle may be >slow but not that slow... > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of >Djabarov, Robert >Sent: Tuesday, February 24, 2004 8:02 AM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >You can also try to load Oracle and DB2 on it, then see who's slower :) > >Robert Djabarov >SQL Server & UDB >Sr. SQL Server Administrator >Phone: (210) 913-3148 >Pager: (210) 753-3148 >9800 Fredericksburg Rd. San Antonio, TX 78288 >www.usaa.com > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim >Lawrence (AccessD) >Sent: Saturday, February 21, 2004 5:16 PM >To: dba-sqlserver at databaseadvisors.com >Subject: [dba-SQLServer] SQL Performance > >Hi All: > >I have just installed a new version of SQL2000 developer on one of my >servers. The sever is not big but has reasonable performance and as I >use it >just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server >software. It is running a number of applications but all seem happy >together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. > >The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing >else is affected and it seems to run and run to do the simplest of >tasks. > >Would anyone have some insight into what could possibly be going wrong. > >Any comments would be greatly appreciated. >MTIA >Jim > > > -- -Francisco From ebarro at afsweb.com Wed Feb 25 11:10:58 2004 From: ebarro at afsweb.com (Eric Barro) Date: Wed, 25 Feb 2004 09:10:58 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <403CD304.7020105@verizon.net> Message-ID: Jim, Is it actual performance (ie retrieving records from SQL and displaying them via ASP or VB front end) or the display of the objects using Enterprise Manager? Can you connect using an Access data project and if so do you get the same slow performance? The reason I want to differentiate is that I've seen this behavior before. I can't quite put my finger on the cause but usually if you press F5 for refresh you will get the results much faster. It's as if the display was waiting for something to trigger it. If you go to My Computer and display the list of drives does it also take a while to display them? Pressing F5 for refresh will display them in an instant. Let me know if I've hit the nail on the head. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, February 25, 2004 8:53 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Performance How much ram did you allocate to SQL Server? If you open EM, and right click on your registered server, you will have a tab for the memory configuration, is it set to fixed, or dynamic, and if dynamic what is the maximum range? Jim Lawrence (AccessD) wrote: >Hi Robert: > >Thanks for the comments...An example of how slow we are talking about is 6.5 >minutes just to display the list of tables from Master DB. Oracle may be >slow but not that slow... > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of >Djabarov, Robert >Sent: Tuesday, February 24, 2004 8:02 AM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >You can also try to load Oracle and DB2 on it, then see who's slower :) > >Robert Djabarov >SQL Server & UDB >Sr. SQL Server Administrator >Phone: (210) 913-3148 >Pager: (210) 753-3148 >9800 Fredericksburg Rd. San Antonio, TX 78288 >www.usaa.com > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim >Lawrence (AccessD) >Sent: Saturday, February 21, 2004 5:16 PM >To: dba-sqlserver at databaseadvisors.com >Subject: [dba-SQLServer] SQL Performance > >Hi All: > >I have just installed a new version of SQL2000 developer on one of my >servers. The sever is not big but has reasonable performance and as I >use it >just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server >software. It is running a number of applications but all seem happy >together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. > >The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing >else is affected and it seems to run and run to do the simplest of >tasks. > >Would anyone have some insight into what could possibly be going wrong. > >Any comments would be greatly appreciated. >MTIA >Jim > > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004 From MarkBoyd at McBeeAssociates.com Wed Feb 25 12:10:36 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Wed, 25 Feb 2004 13:10:36 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. From knicholson at gpsx.net Wed Feb 25 12:23:17 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Wed, 25 Feb 2004 13:23:17 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: I believe you must use CAST to convert NvarChar to Money. so, something like: cast(amount as money) -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Wednesday, February 25, 2004 1:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Kenneth.Stoker at pnl.gov Wed Feb 25 12:23:35 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Wed, 25 Feb 2004 10:23:35 -0800 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: <249C1CB246997C48BB74963CCD361C1B014A04E6@pnlmse28.pnl.gov> This should work. You might have to specify the size, which is 8 bytes, and/or the precision and scale, which are 19 and 4. INSERT INTO Table2 SELECT AcctNum, CONVERT(money, Amount) FROM Table1 Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Wednesday, February 25, 2004 10:11 AM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Robert.Djabarov at usaa.com Wed Feb 25 12:53:33 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 25 Feb 2004 12:53:33 -0600 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECBE@ex02.eagle.usaa.com> You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From MarkBoyd at McBeeAssociates.com Wed Feb 25 13:11:19 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Wed, 25 Feb 2004 14:11:19 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: I'm still having problems. I've tried each suggestion, but unfortunately I still receive an error regarding incorrect syntax. The data from Table1 has values of 175.00, 50.00-, and .00. Do I need to include additional criteria in the replace function to account for these formats? Thanks, Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 1:54 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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.Djabarov at usaa.com Wed Feb 25 13:31:36 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 25 Feb 2004 13:31:36 -0600 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: <3CCEA32DFF043C4CB99B835557E11B3053ECBF@ex02.eagle.usaa.com> Absolutely, except I'd create a function that would handle all that for you: create function dbo.fn_CnvNVarChar2Money ( @amt nvarchar(100) ) returns money as begin declare @Multiplier int if charindex('-', @amt) > 0 set @Multiplier = -1 else set @Multiplier = 1 return (cast(replace(replace(@amt, ',', ''), '-', '') as money) * @Multiplier) end go select dbo.fn_CnvNVarChar2Money('50.00-') Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 1:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money I'm still having problems. I've tried each suggestion, but unfortunately I still receive an error regarding incorrect syntax. The data from Table1 has values of 175.00, 50.00-, and .00. Do I need to include additional criteria in the replace function to account for these formats? Thanks, Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 1:54 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 Robert.Djabarov at usaa.com Wed Feb 25 13:34:52 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Wed, 25 Feb 2004 13:34:52 -0600 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C7CE@ex02.eagle.usaa.com> ...or, as it pertains to your case: insert Table2 select AcctNum, dbo.fn_CnvNVarChar2Money(Amount) from Table1 Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Djabarov, Robert Sent: Wednesday, February 25, 2004 1:32 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money Absolutely, except I'd create a function that would handle all that for you: create function dbo.fn_CnvNVarChar2Money ( @amt nvarchar(100) ) returns money as begin declare @Multiplier int if charindex('-', @amt) > 0 set @Multiplier = -1 else set @Multiplier = 1 return (cast(replace(replace(@amt, ',', ''), '-', '') as money) * @Multiplier) end go select dbo.fn_CnvNVarChar2Money('50.00-') Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 1:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money I'm still having problems. I've tried each suggestion, but unfortunately I still receive an error regarding incorrect syntax. The data from Table1 has values of 175.00, 50.00-, and .00. Do I need to include additional criteria in the replace function to account for these formats? Thanks, Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 1:54 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 MarkBoyd at McBeeAssociates.com Wed Feb 25 13:36:42 2004 From: MarkBoyd at McBeeAssociates.com (Mark Boyd) Date: Wed, 25 Feb 2004 14:36:42 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: Great. Thanks Robert. I'll give this a shot. Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 2:35 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money ...or, as it pertains to your case: insert Table2 select AcctNum, dbo.fn_CnvNVarChar2Money(Amount) from Table1 Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Djabarov, Robert Sent: Wednesday, February 25, 2004 1:32 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money Absolutely, except I'd create a function that would handle all that for you: create function dbo.fn_CnvNVarChar2Money ( @amt nvarchar(100) ) returns money as begin declare @Multiplier int if charindex('-', @amt) > 0 set @Multiplier = -1 else set @Multiplier = 1 return (cast(replace(replace(@amt, ',', ''), '-', '') as money) * @Multiplier) end go select dbo.fn_CnvNVarChar2Money('50.00-') Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 1:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money I'm still having problems. I've tried each suggestion, but unfortunately I still receive an error regarding incorrect syntax. The data from Table1 has values of 175.00, 50.00-, and .00. Do I need to include additional criteria in the replace function to account for these formats? Thanks, Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 1:54 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 knicholson at gpsx.net Wed Feb 25 13:53:04 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Wed, 25 Feb 2004 14:53:04 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: This is how you strip that stuff out: declare @value varchar(50) set @value = '($29.92)' select cast(replace(replace(@value, '(', '-'), ')', '') as money) -----Original Message----- From: Stoker, Kenneth E [mailto:Kenneth.Stoker at pnl.gov] Sent: Wednesday, February 25, 2004 1:24 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money This should work. You might have to specify the size, which is 8 bytes, and/or the precision and scale, which are 19 and 4. INSERT INTO Table2 SELECT AcctNum, CONVERT(money, Amount) FROM Table1 Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov -----Original Message----- From: Mark Boyd [mailto:MarkBoyd at McBeeAssociates.com] Sent: Wednesday, February 25, 2004 10:11 AM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ 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 knicholson at gpsx.net Wed Feb 25 13:53:36 2004 From: knicholson at gpsx.net (Nicholson, Karen) Date: Wed, 25 Feb 2004 14:53:36 -0500 Subject: [dba-SQLServer] Convert nvarchar to money Message-ID: Whoa. Now this is nice. -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 2:35 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money ...or, as it pertains to your case: insert Table2 select AcctNum, dbo.fn_CnvNVarChar2Money(Amount) from Table1 Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Djabarov, Robert Sent: Wednesday, February 25, 2004 1:32 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money Absolutely, except I'd create a function that would handle all that for you: create function dbo.fn_CnvNVarChar2Money ( @amt nvarchar(100) ) returns money as begin declare @Multiplier int if charindex('-', @amt) > 0 set @Multiplier = -1 else set @Multiplier = 1 return (cast(replace(replace(@amt, ',', ''), '-', '') as money) * @Multiplier) end go select dbo.fn_CnvNVarChar2Money('50.00-') Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 1:11 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money I'm still having problems. I've tried each suggestion, but unfortunately I still receive an error regarding incorrect syntax. The data from Table1 has values of 175.00, 50.00-, and .00. Do I need to include additional criteria in the replace function to account for these formats? Thanks, Mark -----Original Message----- From: Djabarov, Robert [mailto:Robert.Djabarov at usaa.com] Sent: Wednesday, February 25, 2004 1:54 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] Convert nvarchar to money You may also have to take into account the value formatting in your NVARCHAR field, like thousand-separator characters, as well as decimal separators. If, for example, the field contains 2,342,985.3400 you'll need to do something like this: cast(replace('2,342,985.3400', ',', '') as money) If the value has period as thousand-separator and a comma for a decimal, you'll need to do a reverse: cast(replace(replace('2.342.985,3400', '.', ''), ',', '.') as money) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Mark Boyd Sent: Wednesday, February 25, 2004 12:11 PM To: SQLServerList Subject: [dba-SQLServer] Convert nvarchar to money I am trying to append data from Table1 to Table2. In Table1, the field [Amount] is datatype 'nvarchar'. In Table2, the field [Amount] is datatype 'money'. I am using the following SQL query to run the append: "INSERT INTO Table2 SELECT AcctNum, Amount FROM Table1". I guess I need to use the CONVERT function, but can't figure out how this is done. Any examples would be greatly appreciated. Thanks, Mark Boyd Sr. Systems Analyst McBee Associates, Inc. _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Thu Feb 26 01:10:39 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Wed, 25 Feb 2004 23:10:39 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <403CD304.7020105@verizon.net> Message-ID: Hi Francisco: Dynamically; the minimum is set to 0Mb and the maximum is set to 1024MB. Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, February 25, 2004 8:53 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Performance How much ram did you allocate to SQL Server? If you open EM, and right click on your registered server, you will have a tab for the memory configuration, is it set to fixed, or dynamic, and if dynamic what is the maximum range? Jim Lawrence (AccessD) wrote: >Hi Robert: > >Thanks for the comments...An example of how slow we are talking about is 6.5 >minutes just to display the list of tables from Master DB. Oracle may be >slow but not that slow... > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of >Djabarov, Robert >Sent: Tuesday, February 24, 2004 8:02 AM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >You can also try to load Oracle and DB2 on it, then see who's slower :) > >Robert Djabarov >SQL Server & UDB >Sr. SQL Server Administrator >Phone: (210) 913-3148 >Pager: (210) 753-3148 >9800 Fredericksburg Rd. San Antonio, TX 78288 >www.usaa.com > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim >Lawrence (AccessD) >Sent: Saturday, February 21, 2004 5:16 PM >To: dba-sqlserver at databaseadvisors.com >Subject: [dba-SQLServer] SQL Performance > >Hi All: > >I have just installed a new version of SQL2000 developer on one of my >servers. The sever is not big but has reasonable performance and as I >use it >just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server >software. It is running a number of applications but all seem happy >together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. > >The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing >else is affected and it seems to run and run to do the simplest of >tasks. > >Would anyone have some insight into what could possibly be going wrong. > >Any comments would be greatly appreciated. >MTIA >Jim > > > -- -Francisco _______________________________________________ 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 Thu Feb 26 01:10:35 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Wed, 25 Feb 2004 23:10:35 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: <3CCEA32DFF043C4CB99B835557E11B3053ECBD@ex02.eagle.usaa.com> Message-ID: Hi Robert: This is where the whole thing get interesting (weird), there is no apparent large utilization of the systems resources when the MSSQL's EM is working; about 1 to 3%, and less than 40MB of memory for all the related services and processes...virtually nothing. The SQL Server service pack is 3a. The server is defragged on a regular bases with an Enterprise version of DisKeeper. The MSSQL is a brand new install so it has not had a chance to create internally fragmentation. I am sure it is something simple, like a registry setting but where would I look? Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Djabarov, Robert Sent: Wednesday, February 25, 2004 6:36 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Jim, The remark I made was really derogatory, because I think you already have quite a bit on this box. In addition, you need to make sure you apply SP3 to your SQL install. If the problem persists, follow the rule of thumb, -there are 3 things that can cause such slow performance, - CPU, memory, or IO subsystem. The easiest way to see if the first 2 are an issue is to open task manager and select Processes tab. Click on CPU column header a couple of times and see what process other than System Idle Process may be taking all the CPU. Do the same with Memory column. I did observe performance degradation on my laptop (2.6GHz, 1GB memory, 120GB HD) with default and named instances of Personal edition, and managed to fix it by defragmenting the program files and data and log devices of master databases on both instances. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Tuesday, February 24, 2004 7:44 PM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Hi Robert: Thanks for the comments...An example of how slow we are talking about is 6.5 minutes just to display the list of tables from Master DB. Oracle may be slow but not that slow... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Djabarov, Robert Sent: Tuesday, February 24, 2004 8:02 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance You can also try to load Oracle and DB2 on it, then see who's slower :) Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence (AccessD) Sent: Saturday, February 21, 2004 5:16 PM To: dba-sqlserver at databaseadvisors.com Subject: [dba-SQLServer] SQL Performance Hi All: I have just installed a new version of SQL2000 developer on one of my servers. The sever is not big but has reasonable performance and as I use it just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server software. It is running a number of applications but all seem happy together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing else is affected and it seems to run and run to do the simplest of tasks. Would anyone have some insight into what could possibly be going wrong. Any comments would be greatly appreciated. MTIA Jim _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From accessd at shaw.ca Thu Feb 26 01:20:55 2004 From: accessd at shaw.ca (Jim Lawrence (AccessD)) Date: Wed, 25 Feb 2004 23:20:55 -0800 Subject: [dba-SQLServer] SQL Performance In-Reply-To: Message-ID: Hi Eric: I am currently just using the EM to display the records. I was hoping to have the app running at a reasonable speed before I started adding databases. (I have a couple already built). The drives, on the server, are fairly big and probably should have been partitioned...(160GB each) but the performance, even displaying the directory tree is not slow. Unfortunately, F5, did not do anything. Thanks Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Eric Barro Sent: Wednesday, February 25, 2004 9:11 AM To: dba-sqlserver at databaseadvisors.com Subject: RE: [dba-SQLServer] SQL Performance Jim, Is it actual performance (ie retrieving records from SQL and displaying them via ASP or VB front end) or the display of the objects using Enterprise Manager? Can you connect using an Access data project and if so do you get the same slow performance? The reason I want to differentiate is that I've seen this behavior before. I can't quite put my finger on the cause but usually if you press F5 for refresh you will get the results much faster. It's as if the display was waiting for something to trigger it. If you go to My Computer and display the list of drives does it also take a while to display them? Pressing F5 for refresh will display them in an instant. Let me know if I've hit the nail on the head. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, February 25, 2004 8:53 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] SQL Performance How much ram did you allocate to SQL Server? If you open EM, and right click on your registered server, you will have a tab for the memory configuration, is it set to fixed, or dynamic, and if dynamic what is the maximum range? Jim Lawrence (AccessD) wrote: >Hi Robert: > >Thanks for the comments...An example of how slow we are talking about is 6.5 >minutes just to display the list of tables from Master DB. Oracle may be >slow but not that slow... > >Jim > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com]On Behalf Of >Djabarov, Robert >Sent: Tuesday, February 24, 2004 8:02 AM >To: dba-sqlserver at databaseadvisors.com >Subject: RE: [dba-SQLServer] SQL Performance > > >You can also try to load Oracle and DB2 on it, then see who's slower :) > >Robert Djabarov >SQL Server & UDB >Sr. SQL Server Administrator >Phone: (210) 913-3148 >Pager: (210) 753-3148 >9800 Fredericksburg Rd. San Antonio, TX 78288 >www.usaa.com > >-----Original Message----- >From: dba-sqlserver-bounces at databaseadvisors.com >[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Jim >Lawrence (AccessD) >Sent: Saturday, February 21, 2004 5:16 PM >To: dba-sqlserver at databaseadvisors.com >Subject: [dba-SQLServer] SQL Performance > >Hi All: > >I have just installed a new version of SQL2000 developer on one of my >servers. The sever is not big but has reasonable performance and as I >use it >just for testing... It is 1700Mhz, 1GB RAM, Windows2000 advanced Server >software. It is running a number of applications but all seem happy >together; ASP, JSP, Perl PHP, JSP with IIS and MySQL. > >The recently installed MSSQL 2000 runs like a dog; so sloooooow. Nothing >else is affected and it seems to run and run to do the simplest of >tasks. > >Would anyone have some insight into what could possibly be going wrong. > >Any comments would be greatly appreciated. >MTIA >Jim > > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 2/20/2004 _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From paul.hartland at fsmail.net Thu Feb 26 09:31:53 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Thu, 26 Feb 2004 16:31:53 +0100 (CET) Subject: [dba-SQLServer] Stored Procedure Help Required Message-ID: <30802611.1077809513039.JavaMail.www@wwinf3004> To all, I?m ok with basic stored procedure?s, however I want to try something just a little more advanced. I have the following SP at the moment: CREATE PROCEDURE [genesis_insert_AvailabilityAll] (@PayrollNo_2 [nvarchar](35), @JobDate_3 [datetime], @AvailCode_4 [nvarchar](2), @Type_5 [int]) AS SET NOCOUNT ON INSERT INTO [GenesisTest].[dbo].[tblAvailabilityAll] ( [PayrollNo], [JobDate], [AvailabilityCode], [Type]) VALUES ( @PayrollNo_2, @JobDate_3, @AvailCode_4, @Type_5) The above SP inserts an availability record into tblAvailabilityAll, however the employee has to be given three types of availability 0, 1, 2 I have a Visual Basic FE and have a loop which passes the PayrollNo, JobDate, AvailCode and Type. As Type is the only value that changes, is there a way I could just pass the SP PayrollNo, JobDate and Availcode and have the SP increment the type ? Thanks in advance for any help received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From Robert.Djabarov at usaa.com Thu Feb 26 10:32:44 2004 From: Robert.Djabarov at usaa.com (Djabarov, Robert) Date: Thu, 26 Feb 2004 10:32:44 -0600 Subject: [dba-SQLServer] Stored Procedure Help Required Message-ID: <3CCEA32DFF043C4CB99B835557E11B3003C6C7D3@ex02.eagle.usaa.com> If Availability Type is stored somewhere in the system in the form of, let's say, table (tblAvailabilityTypes) structured as Type int, Description varchar(...), etc., then you can convert your VALUES clause into SELECT: ... SELECT @PayrollNo_2, @JobDate_3, @AvailCode_4, Type From tblAvailabilityTypes This way you don't even have to pass your @Type_5 as a parameter. Robert Djabarov SQL Server & UDB Sr. SQL Server Administrator Phone: (210) 913-3148 Pager: (210) 753-3148 9800 Fredericksburg Rd. San Antonio, TX 78288 www.usaa.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Thursday, February 26, 2004 9:32 AM To: dba-sqlserver Subject: [dba-SQLServer] Stored Procedure Help Required To all, I'm ok with basic stored procedure's, however I want to try something just a little more advanced. I have the following SP at the moment: CREATE PROCEDURE [genesis_insert_AvailabilityAll] (@PayrollNo_2 [nvarchar](35), @JobDate_3 [datetime], @AvailCode_4 [nvarchar](2), @Type_5 [int]) AS SET NOCOUNT ON INSERT INTO [GenesisTest].[dbo].[tblAvailabilityAll] ( [PayrollNo], [JobDate], [AvailabilityCode], [Type]) VALUES ( @PayrollNo_2, @JobDate_3, @AvailCode_4, @Type_5) The above SP inserts an availability record into tblAvailabilityAll, however the employee has to be given three types of availability 0, 1, 2 I have a Visual Basic FE and have a loop which passes the PayrollNo, JobDate, AvailCode and Type. As Type is the only value that changes, is there a way I could just pass the SP PayrollNo, JobDate and Availcode and have the SP increment the type ? Thanks in advance for any help received. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From Kenneth.Stoker at pnl.gov Thu Feb 26 11:43:35 2004 From: Kenneth.Stoker at pnl.gov (Stoker, Kenneth E) Date: Thu, 26 Feb 2004 09:43:35 -0800 Subject: [dba-SQLServer] Updatable Views with more than one base table. Message-ID: <249C1CB246997C48BB74963CCD361C1B07C983@pnlmse28.pnl.gov> Everyone, I read this in BOL: Updatable views can modify more than one table involved in the view. The DELETE, INSERT, and UPDATE statements can reference a view as long as SQL Server can translate the user's update request unambiguously to updates in the base tables referenced in the view's definition. I have a view that is derived from one table with the exception that a couple of the fields in the view are derived from sub-queries. The values in derived from the sub-queries should not be updated, but it is desired that all other columns in the view be updatable. As it is now, all fields are not updatable. How can I make the view update the one table? Can I not use sub-queries to derive those values? Do any of you have examples of updatable views with multiple tables that you can share? BOL doesn't have much here that I can find, although I will keep looking. Thanks. Ken Stoker Technology Commercialization Information Systems Administrator PH: (509) 375-3758 FAX: (509) 375-6731 E-mail: Kenneth.Stoker at pnl.gov From paul.hartland at fsmail.net Fri Feb 27 06:20:15 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Fri, 27 Feb 2004 13:20:15 +0100 (CET) Subject: [dba-SQLServer] Stored Procedure Help Required Message-ID: <23001706.1077884415170.JavaMail.www@wwinf3006> To all, I?m sure this is possible, but being quite a novice at Stored Procedures (i.e. able to write simple SELECT, INSERT, DELETE & UPDATE procs) I don?t know how to go about this. I want to write an SP which I call from Visual Basic which sends the current UserID (I know how to do this bit) I then want the SP to call another SP using the UserID I passed to it. Then I want to use the fields PayrollNo and JobDate from the second SP to execute a third SP passing the parameters PayrollNo and Jobdate. I hope I haven?t confused people too much, and any help will be greatly appreciated. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From my.lists at verizon.net Fri Feb 27 12:58:21 2004 From: my.lists at verizon.net (Francisco H Tapia) Date: Fri, 27 Feb 2004 10:58:21 -0800 Subject: [dba-SQLServer] Stored Procedure Help Required In-Reply-To: <23001706.1077884415170.JavaMail.www@wwinf3006> References: <23001706.1077884415170.JavaMail.www@wwinf3006> Message-ID: <403F934D.6030101@verizon.net> paul.hartland at fsmail.net wrote: >To all, > >I?m sure this is possible, but being quite a novice at Stored Procedures (i.e. able to write simple SELECT, INSERT, DELETE & UPDATE procs) I don?t know how to go about this. > >I want to write an SP which I call from Visual Basic which sends the current UserID (I know how to do this bit) I then want the SP to call another SP using the UserID I passed to it. Then I want to use the fields PayrollNo and JobDate from the second SP to execute a third SP passing the parameters PayrollNo and Jobdate. > > this is easy enough w/o output parameters (if you don't want to get into it) EXEC Sproc1 (@userid as varchar(20)) AS SET NOCOUNT ON CREATE TABLE #Temp1 (PayRollNo varchar(25), JobDate varchar(25)) INSERT INTO #Temp1 EXEC sproc2 @UserID DECLARE @Param1 as varchar(25), @param2 as Varchar(25) SELECT @Param1 = Field1, @param2 = Field2 From #Temp1 Exec Sproc3 @Param1, @Param2 SET NOCOUNT OFF by the way if you're practicing your sprocs try looking in QA (sql server 2000) and using the tools there, it has simple things such as it will create an select/insert/update/delete statement for a table/view/sproc. check itout you'll find that you'll be writing more and more complex sprocs in no time.... using gui tools like in EM and Access' QBE I've found are a terrible crutch cuz normally you don't take the time to fully examine the sql. -- -Francisco From artful at rogers.com Fri Feb 27 23:49:25 2004 From: artful at rogers.com (Arthur Fuller) Date: Fri, 27 Feb 2004 21:49:25 -0800 Subject: [dba-SQLServer] Stored Procedure Help Required In-Reply-To: <403F934D.6030101@verizon.net> Message-ID: <02d201c3fdbe$9f285520$6501a8c0@rock> I have no comment on your reply except to say that you are WAY KEWL Francisco! You splain everything very nice. Hats off to you! -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Francisco H Tapia Sent: Friday, February 27, 2004 10:58 AM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Stored Procedure Help Required paul.hartland at fsmail.net wrote: >To all, > >I'm sure this is possible, but being quite a novice at Stored >Procedures (i.e. able to write simple SELECT, INSERT, DELETE & UPDATE procs) I don't know how to go about this. > >I want to write an SP which I call from Visual Basic which sends the >current UserID (I know how to do this bit) I then want the SP to call another SP using the UserID I passed to it. Then I want to use the fields PayrollNo and JobDate from the second SP to execute a third SP passing the parameters PayrollNo and Jobdate. > > this is easy enough w/o output parameters (if you don't want to get into it) EXEC Sproc1 (@userid as varchar(20)) AS SET NOCOUNT ON CREATE TABLE #Temp1 (PayRollNo varchar(25), JobDate varchar(25)) INSERT INTO #Temp1 EXEC sproc2 @UserID DECLARE @Param1 as varchar(25), @param2 as Varchar(25) SELECT @Param1 = Field1, @param2 = Field2 From #Temp1 Exec Sproc3 @Param1, @Param2 SET NOCOUNT OFF by the way if you're practicing your sprocs try looking in QA (sql server 2000) and using the tools there, it has simple things such as it will create an select/insert/update/delete statement for a table/view/sproc. check itout you'll find that you'll be writing more and more complex sprocs in no time.... using gui tools like in EM and Access' QBE I've found are a terrible crutch cuz normally you don't take the time to fully examine the sql. -- -Francisco _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com