How do I perform a sql query using variables?, something like
select * from table1 where field1=VARIABLE
I supose, but I cant get it right.
Thank You
How do I perform a sql query using variables?, something like
select * from table1 where field1=VARIABLE
I supose, but I cant get it right.
Thank You
Found it out myself......should be
select * from table1 where field1="& VARIABLE &"
Quote:>How do I perform a sql query using variables?, something like
>select * from table1 where field1=VARIABLE
>I supose, but I cant get it right.
>Thank You
>select * from table1 where field1=VARIABLE
>I supose, but I cant get it right.
"select * from table1 where field1 = #" & variable & "#" if it's a date
variable.
"select * from table1 where field1 = " & variable if it's a
numeric variable.
Lee Weiner
weiner AT fuse DOT net
' For StringsQuote:>select * from table1 where field1=VARIABLE
Data1.recordsource = "SELECT * FROM [Table] WHERE [Field] = ' " &
UserChoice$ & " ' "
'For Numeric
UserChoise% = CInt(Text1.Text)
Data1.recordsource = "SELECT * FROM [Table] WHERE [Field] = " & UserChoice%
Hope this helps
David.....
1. DTS: Using Global Variables in a DT SQL Query
I am developing a package that will utilitize VB talking to a DTS Package.
In the package I would like to use GlobalVariables to select subsets of the
data. Is there a way in the SQL portion of the DTS Workflow to use the
value from the global Variable.
I have not found any documentation about how this might be accomplished.
Any suggestions would be greatly appreciated,
John
3. Help:SQL Query using a Date/time variable
4. : identifying runaway DB clients
5. Help with SQL query using LIKE and variable field
6. Parsing in Trans-SQL -- Need Help
8. PLEASE HELP: Using Variables within SQL Queries
9. Using variables in SQL queries
10. SQL query using a variable
11. Using a variable in a SQL Query
12. Find using sql query with variable having an apostrophe