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 |
jazzgirl
Starting Member
6 Posts |
Posted - 2012-04-02 : 15:23:13
|
I am working on a sql server 2008 r2 database to run adhoc queries. I would like to be able to run some sql that uses parameters. I do not want to setup a stored procedure. All I can find on the internet are ways of how to setup parameters for a stored procedure.Can you tell me or point me to a reference thagt will show me how to setup some sql that I can execute that takes in parameters?basically i want to run some sql without hard coding the dates all the time. |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-04-02 : 15:36:27
|
You can use prepared statements - this page has description and examples: http://msdn.microsoft.com/en-us/library/ms175528(v=sql.105).aspx For language specific examples, google for "prepared statements" for that language. For example, I know you can do this with Java/JDBC as well as with .Net. |
 |
|
jazzgirl
Starting Member
6 Posts |
Posted - 2012-04-03 : 10:35:58
|
thanks! |
 |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-04-03 : 10:47:44
|
quote: Originally posted by jazzgirlI do not want to setup a stored procedure.
Why not? Too easy? Too scalable? Too maintainable? Too secure?How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|