Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
awaisahmad435
Starting Member
11 Posts |
Posted - 2011-06-01 : 06:11:33
|
| i have created a stored procedure which runs Perfect in SQL Server 2008 but producing error in SQL Server 2005... The error isonly one expression can be specified in the select list when the subquery is not introduced with existsthe procedure is below. plz help me where i m wrong...CREATE PROCEDURE Refresh_Lock ASDECLARE @AccountID VARCHAR(100)DECLARE @getAccountID CURSORSET @getAccountID = CURSOR FORSELECT TABLENAMEFROM DBO.TMPOPEN @getAccountIDFETCH NEXTFROM @getAccountID INTO @AccountIDWHILE @@FETCH_STATUS = 0BEGINPRINT @AccountID EXEC('update ' + @AccountID + 'set flag = ''FREE9''where SYSTEMID in (select b.systemidfrom sys.dm_exec_connections aright outer join dbo.TMP b on b.ipaddress = a.client_net_addresswhere a.session_id is nulland b.tablename = ''' + @AccountID + ''')')EXEC('delete from dbo.tmpwhere SYSTEMID in (select b.systemidfrom sys.dm_exec_connections aright outer join dbo.TMP b on b.ipaddress = a.client_net_addresswhere a.session_id is nulland b.tablename = ''' + @AccountID + ''')')FETCH NEXTFROM @getAccountID INTO @AccountIDENDCLOSE @getAccountIDDEALLOCATE @getAccountID |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-06-01 : 06:29:03
|
| Which statement is giving you the error?Check that the set cursor statement is valid in v2005.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
|
|
|
|
|