|
-
May 24th, 2000, 05:00 AM
#1
Thread Starter
Addicted Member
How do I put a select statement into a variable? Do I declare it and with what?
SELECT COUNT (*)as 'Your a Lammo' from dbo.vw_Lammo
Where vendor_err='x' and created_dt>@FromDate
How would I put this into a variable? or the count of this into a variable in SQL?
-
May 24th, 2000, 06:21 AM
#2
Note sure if this answers your question but....
Private sSQL as String
Private rData as Recordset
sSQL = "SELECT......whatever"
Set rData = db.OpenRecordset(sSQL)
Hope it helps
-
May 24th, 2000, 06:25 AM
#3
New Member
if you are trying to post a variable's value in the SQL statement, the simply concatenate the text with the variable in it. eg: "SELECT * FROM tblTable WHERE Field1='" & strVarName & "'"
If you are trying to do something else, please be a little more specific as to what you are trying to achieve.
Have Fun!
-
May 24th, 2000, 08:11 AM
#4
Thread Starter
Addicted Member
Here's what I did
Declare @FirstQuery int
SELECT @FirstQuery =(SELECT COUNT (*)as 'Your a Lammo' from dbo.vw_Lammo
Where vendor_err='x' and created_dt>@FromDate)
And this worked!!!
Thanks for all the replies.
This was a stored procedure doing a query to get a count.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|