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)
 SP And Query

Author  Topic 

kamalkishore_in
Yak Posting Veteran

76 Posts

Posted - 2002-10-02 : 02:04:29
Hi friends,

Is it possible to pass a Filtered Query to a Stored Procedure using a String Variable. And execute it. Like

Exec SP1 'Where Code = 100'

---------------------------------------------------------
Create Procedure SP1
@Query as varchar(2000)
AS

-- I dont know how to perform this
Select * from Table & @Query

GO

All I am requesting is can we execute a String variable which contains my sql Query in SP.

Thankx



Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-10-02 : 02:11:13
Hi

You will need some Dynamic SQL for that.

Damian
Go to Top of Page
   

- Advertisement -