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
 VBScript, SQL and the LEFT OUTER JOIN command

Author  Topic 

jetsetterjay
Starting Member

3 Posts

Posted - 2007-09-12 : 01:03:37
Hello,
I have only started VBS and SQL a week ago so..

The scenario is that I have 1 SQL db and 3 tables as follows:

tblSAVDetails (columns SERVERS : SAVGroup : SAVParent)
tblSAVComputers (Columns SERVERS)
tblSAVResults (Columns SERVERS : SAVGroup : SAVParent)

The tblSAVDetails has raw data from all of our servers nationwide
The tblSAVComputers have a list of servers in our site
The SAVResults will store the results of the query

I want compare the list of servers in tblSAVComputers with the list contained in tblSAVDetails and IF it finds the server to then retrieve the details. However if it doesn't find the server I want to flag it (with a NULL or NA or somthing). After all that I want it to insert the results into tblSAVResults.

The SQL command I am using is:
---------
SELECT *
FROM tblSAVComputers LEFT OUTER JOIN
tblSAVDetails ON tblSAVComputers.SAVComputers = tblSAVDetails.SERVERS
---------

I have tried so many ways, but I just cant get it to work. I know how to insert data into a DB, but I just cant get this command to work in vbScript (it works fine if I run it directly on the SQL server)

Any help would be brilliant! If you need more info, please let me know.

Thanks

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-09-12 : 07:37:37
put the question in VB forum instead here......

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

jetsetterjay
Starting Member

3 Posts

Posted - 2007-09-12 : 19:16:28
quote:
Originally posted by sunsanvin

put the question in VB forum instead here......

Vinod
Even you learn 1%, Learn it with 100% confidence.



Gotcha.. will do
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-09-12 : 20:35:57
see
http://www.nigelrivett.net/DTS/DTSExecuteStoredProcedure.html

That's for running an sp - chnaget the command type to run a 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

jetsetterjay
Starting Member

3 Posts

Posted - 2007-09-21 : 01:08:33
Perfect! Thanks for that.. really handy to know!
Go to Top of Page
   

- Advertisement -