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
 Transact-SQL (2000)
 Visual Studio - parameters

Author  Topic 

jewel
Starting Member

18 Posts

Posted - 2004-10-06 : 19:37:44
hi All

can you set parameters in sql like you can in Access.

eg designing a query and I want the user to key in date

in criteria field for date I would have done
=[firstdate] AND [lastdate]

if I add it in to my query criteria in Visual Studio I get
"[firstdate]"in expression is not part of the query.

when this is ok I deploy to a server using msdn reports - does this impact on this at all

thanks

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-10-08 : 13:57:47
It depends on what client side tool you are using. SQL Server doesn't have any client side component (no part of the server itself runs on the user's machine, although MSDE is something of an exception).

For example, if you are using MS-Access to query linked tables on SQL Server, you can write the queries exactly as you would with Jet (the native database for MS-Access). This probably isn't the most efficient way to do things, but it forces the least change on the developer/user.

Other tools like MS Reporting Services require you to supply parameters "up front", typically from a web page. The user's perception is about the same as the MS-Access query, but the developer's perception is quite different.

-PatP
Go to Top of Page

tuenty
Constraint Violating Yak Guru

278 Posts

Posted - 2004-10-08 : 17:51:40
a stored procedure will do that(check BOL)
CREATE PROC [ EDURE ] procedure_name [ ; number ] 
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]

[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]

[ FOR REPLICATION ]


*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*

A candle loses nothing by lighting another candle
Go to Top of Page
   

- Advertisement -