|
Re: SQL: msg#00362windows.devel.dotnet.winforms
You can not parameterize the tablename part of a sql statement. Use something like: declare @s varchar(500) declare @t varchar(500) set @t = 'tblArtist' set @s = 'select * from ' + @t exec sp_sqlexec @s Hth, Michel. -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx] On Behalf Of Andrew Dunn Sent: donderdag 26 februari 2004 7:07 To: DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx Subject: Re: [DOTNET-WINFORMS] SQL Seems that didn't fix my problem :( -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx] On Behalf Of Vince P Sent: Thursday, 26 February 2004 12:00 PM To: DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx Subject: Re: [DOTNET-WINFORMS] SQL I think you need BEGIN and END frame in your WHILE ___________ Vince P http://66.93.114.145/vince/ MSN Messenger: this address AIM: pacelvi "Nobody said it'd be easy. Nobody said that it would be this hard." - Coldplay -----Original Message----- From: Discussion forum for developers using Windows Forms to build apps and controls [mailto:DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx] On Behalf Of Andrew Dunn Sent: Wednesday, 25 February, 2004 20:07 To: DOTNET-WINFORMS@xxxxxxxxxxxxxxxxxxx Subject: [DOTNET-WINFORMS] SQL Can someone tell me what is wrong with this? I get the error: ---------------- Server: Msg 137, Level 15, State 2, Line 16 Must declare the variable '@TABLE_NAME'. ---------------- DECLARE @INSTALLATION_DATE DateTime DECLARE @NO_MONTHS int DECLARE @EMPTY_MONTHS varchar(50) DECLARE @COUNTER int DECLARE @TABLE_NAME varchar(50) SET @TABLE_NAME = '__After_Hours_Monthly' SET @COUNTER = 0 SET @INSTALLATION_DATE = (Select Installation_Date From __Installation_Date) SET @NO_MONTHS = DATEDIFF(m,@INSTALLATION_DATE,GETDATE()) WHILE @COUNTER > 0 SELECT * FROM @TABLE_NAME SET @COUNTER = @COUNTER - 1 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: SQL: 00362, Andrew Dunn |
|---|---|
| Next by Date: | DataGrid Binding Display Junk Characters: 00362, Mihir Pathak |
| Previous by Thread: | Re: SQLi: 00362, Andrew Dunn |
| Next by Thread: | Re: SQL: 00362, Abir Bhattacharyya |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |