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)
 OPENQUERY - no hardcoded strings please !

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-21 : 18:24:00
Tim writes "Inside an SP I want to do an openquery with a parameter

SELECT * into #tmpSTATE
FROM OPENQUERY(LNK,'SELECT * FROM STATE WHERE STATECODE='+@STATE)

OR

SELECT @SQL='SELECT * FROM STATE WHERE STATECODE='''+@STATE+'''

SELECT * into #tmpSTATE
FROM OPENQUERY(LNK,@SQL)

I Can only get it to work with hardcode strings like

SELECT * into #tmpSTATE
FROM OPENQUERY(LNK,'SELECT * FROM STATE WHERE STATECODE='VT')


Can you get this to work on SQL7 SP2 running Windows 2000"
   

- Advertisement -