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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-11-07 : 09:05:45
|
| Vinny writes "I have a Sql Server 7.0 database running on Windows 2000 Server. I have a linked server, and I have created the following stored procedure:create procedure (proc1)asselect * from openquery(linkedserver,"select col1,col2,col3,col4 from tablename where col1 > 0 and col2 > '31 oct 01 12:00pm' and col2 < '31 oct 01 3:00pm'")This works fine. However, I would like to be able to pass the date to the procedure. I used the following:create procedure (proc1)@startdate datetime@enddate datetimeasselect * from openquery(linkedserver,"select col1,col2,col3,col4 from tablename where col1 > 0 and col2 > ' + @startdate + ' and col2 < ' + @enddate + '")This query passes the stored procedure syntax check, but fails to execute. Is what I am trying to accomplish possible? If it is, can you tell me the correct syntax.Thank you" |
|
|
|
|
|