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
 SQL Server Development (2000)
 Using variables in where clause on querys

Author  Topic 

ramonmch
Starting Member

5 Posts

Posted - 2004-05-21 : 17:01:03
I have just switched from msaccess and do not know how to build expressions as in access. Also do not know how to compare a field column to a variable within a FORM. Please advise how to get more info on building queries with variables. thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-21 : 17:03:55
DECLARE @Var1 INT

SET @Var1 = 2

SELECT *
FROM Table1
WHERE Column1 = @Var1

Tara
Go to Top of Page

ramonmch
Starting Member

5 Posts

Posted - 2004-05-24 : 12:36:12
Tara

Thanks for the ansewer but the question is:

If I have a form in an access project (adp), when we create a query with a where clause like:

SELECT *
FROM Table1
WHERE Column1=Form_Form1.myvar

this should do in access but it does not works the same with sql server.

What Am I doing wrong ?

Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-24 : 12:38:22
I would try the Access forum:

http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3

Tara
Go to Top of Page
   

- Advertisement -