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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select

Author  Topic 

Saeed
Starting Member

39 Posts

Posted - 2002-07-09 : 18:21:13
In an stored procedure , where you form your select statement
like

@myselct is a varchar and

select @myselect="insert ....."

how do you execute this select.I m using "exec @myselect" but i think this is not what i should be using in a stored procedure.....

nr
SQLTeam MVY

12543 Posts

Posted - 2002-07-09 : 18:54:37
Have you looked at exec in the bol?
exec (@myselect)

or (must be an nvarchar for this)

exec sp_exeutesql @myselect

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Saeed
Starting Member

39 Posts

Posted - 2002-07-09 : 19:21:09
1/2 Hr ago I found the solution.
exactly what you mentioned
Thanks

quote:

Have you looked at exec in the bol?
exec (@myselect)

or (must be an nvarchar for this)

exec sp_exeutesql @myselect

==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.



Go to Top of Page
   

- Advertisement -