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
 General SQL Server Forums
 New to SQL Server Programming
 OPEN QUERY WITH PARAMETER

Author  Topic 

rajarajan
Starting Member

48 Posts

Posted - 2011-09-20 : 12:49:13
THIS WIL SOLVE
OPEN QUERY WITH PARAMETER
SELECT * FROM OPENQUERY(LINKSERVERNAME,'SELECT * FROM TABLENAME')WHERE TABLENAME.COLUMN = PARAMETER

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 13:02:22
see

http://www.sommarskog.se/dynamic_sql.html#OPENQUERY


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rajarajan
Starting Member

48 Posts

Posted - 2011-09-20 : 13:23:10
I SAW THE POST ,I THINK THE LOGIC WILL NOT WORK
COZ WHEN U RUN THE QUERY IT WILL SHOW ERROR

ANY SUGGESTION WELCOMW
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 13:39:30
nope it will work. post your tried query

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 13:41:25
even otherwise you can use sp_executesql

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rajarajan
Starting Member

48 Posts

Posted - 2011-09-21 : 08:54:22
SELECT * FROM OPENQUERY(LINKSERVERNAME,'SELECT * FROM TABLENAME')WHERE TABLENAME.COLUMN = @PARAMETER

I have used like this .
Go to Top of Page
   

- Advertisement -