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
 General SQL Server Forums
 New to SQL Server Programming
 Variables in MS SQL

Author  Topic 

golan
Starting Member

6 Posts

Posted - 2006-04-14 : 18:15:40
I have a MS SQL server DB which stores tables and queries and a MS Access DB which acts as an interface and stores Forms.
I am a MS Access Developre and this is my first MS Sql Server DB. I would like to know how can i pass a variable which is an object in a Form (In MS Access DB) to a query in MS SQL?

In MS Access( i mean mdb file which all tables, queries and forms are in one mdb file)it is very easy, for example if you would like to pass idfld from Form of frminfo to a query you can say: Where idname like " & Forms!frminfo!idfld , but it does not work on MS SQL.
Would you please tell me how can i use a variable in MS SQL query?

Thank
Ebi

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-14 : 18:27:47
Usually you interact with sql server via stored procedures and pass them parameters.
If you want to access the structure directly then you have to build the where clause into the query.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

golan
Starting Member

6 Posts

Posted - 2006-04-14 : 18:41:20
Hi nr,
what is the code in MS SQL?
In MS Access as i told to get a variable from a Form is:
Select *
From frminfo
Where idname like Forms!frminfo!idfld
which "Forms!frminfo!idfld" is our variable and come from frminfo Form. well my question is what is the syntax in MS SQL?
I used same in MS SQL but it asks me "Enter Parameter Value". any help?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-14 : 19:14:19
sql server doesn't know anything about the form. It's a database - access gives you a client interface application as well.
It depends on how you are trying to access the database from the cliect as to what your code would look like.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-04-14 : 19:43:08
Golan, U may need to learn about ADO or some such to interact with SQL server.

Srinika
Go to Top of Page

golan
Starting Member

6 Posts

Posted - 2006-04-15 : 02:07:25
Hi Srinika,
could you please give me more information about the ado?
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-15 : 02:11:46
I guess this will be good peice of information for u
http://support.microsoft.com/kb/281998

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

golan
Starting Member

6 Posts

Posted - 2006-04-15 : 02:40:38
Hi chiragkhabaria,
It is really helpfull, I just took a look at it and it seems it is good.
Go to Top of Page

golan
Starting Member

6 Posts

Posted - 2006-04-15 : 16:03:39
Hi chiragkhabaria,
The http://support.microsoft.com/kb/281998 was my answer.
Thanks


Go to Top of Page
   

- Advertisement -