![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Hello. I'm using SQL query analyzer to run some queries against an SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce SQL I took in school. To put it simply, I'm trying to write a query to pull records that match a variable input. In Oracle, I'd use a substitution variable like this... SELECT * FROM jobs WHERE jobid = &job_id_to_query; Is this possible under SQL2000? Is this only a feature of SQL*Plus? TIA Rich |
#4
| |||
| |||
|
|
Try: DECLARE @job_id_to_query int SET @job_id_to_query = 1 SELECT * FROM jobs WHERE jobid = @job_id_to_query -- Hope this helps. Dan Guzman SQL Server MVP rgonzale6 (AT) bellsouth (DOT) net> wrote in message news:1112907568.353348.305460 (AT) z14g2000cwz (DOT) googlegroups.com... Hello. I'm using SQL query analyzer to run some queries against an SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce SQL I took in school. To put it simply, I'm trying to write a query to pull records that match a variable input. In Oracle, I'd use a substitution variable like this... SELECT * FROM jobs WHERE jobid = &job_id_to_query; Is this possible under SQL2000? Is this only a feature of SQL*Plus? TIA Rich |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Would this codepiece bring up a user input prompt upon execution and then run the query using the input that's passed? That was my experience under Oracle MySQL. |
|
Dan Guzman wrote: Try: DECLARE @job_id_to_query int SET @job_id_to_query = 1 SELECT * FROM jobs WHERE jobid = @job_id_to_query -- Hope this helps. Dan Guzman SQL Server MVP rgonzale6 (AT) bellsouth (DOT) net> wrote in message news:1112907568.353348.305460 (AT) z14g2000cwz (DOT) googlegroups.com... Hello. I'm using SQL query analyzer to run some queries against an SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce SQL I took in school. To put it simply, I'm trying to write a query to pull records that match a variable input. In Oracle, I'd use a substitution variable like this... SELECT * FROM jobs WHERE jobid = &job_id_to_query; Is this possible under SQL2000? Is this only a feature of SQL*Plus? TIA Rich Would this codepiece bring up a user input prompt upon execution and then run the query using the input that's passed? That was my experience under Oracle MySQL. Thanks for your response! Rich |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Well, what I'm trying to do is dump an SQL query into a command for Crystal Reports reporting. I need the report to ask me for input upon execution and have the SQL query return the results into the report based on the input. Thanks for your repsonse! Rich |
#9
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |