Jump to content

Problem running OSQL


Recommended Posts

I am trying to run OSQL to update a customer ID. From a cmd line everything seems fine, but I am unable to get the Run statement to work correctly. I have been unable to troubleshoot as the window that opens when I do the Run doesnt stay open long enough to see if there is an error. Any help is greatly appreciated.

Run ('C:\TEMP\osql.exe -S 192.68.1.1 -d Database -U USER -P PASSWORD -Q "update profile set custid = ''$NewID'' where custid = ''$OldID'' update calllog set custid = ''$NewID'' where custid = ''$OldID'' update subset set custid = ''$NewID'' where custid = ''$OldID''"', "" )

Edited by McGyver
Link to comment
Share on other sites

  • Developers

try this to see if the cmd window stays open after the error:

Run (@ComSpec & ' /k C:\TEMP\osql.exe -S 192.68.1.1 -d Database -U USER -P PASSWORD -Q "update profile set custid = ''$NewID'' where custid = ''$OldID'' update calllog set custid = ''$NewID'' where custid = ''$OldID'' update subset set custid = ''$NewID'' where custid = ''$OldID''"', "" )

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

try this to see if the cmd window stays open after the error:

Run (@ComSpec & ' /k C:\TEMP\osql.exe -S 192.68.1.1 -d Database -U USER -P PASSWORD -Q "update profile set custid = ''$NewID'' where custid = ''$OldID'' update calllog set custid = ''$NewID'' where custid = ''$OldID'' update subset set custid = ''$NewID'' where custid = ''$OldID''"', "" )

That gets me a window that stays open. The response back from OSQL is that 0 rows were affected. If I fill in the variables with the actual values, everything works fine. Is it not possible to use variable in the way that I have?

Link to comment
Share on other sites

  • Developers

Didn't look at the whole line before. this should be close to also use the variables:

Run (@ComSpec & ' /k C:\TEMP\osql.exe -S 192.68.1.1 -d Database -U USER -P PASSWORD -Q "update profile set custid = ''' & $NewID & ''' where custid = ''' & $OldID & ''' update calllog set custid = ''' & $NewID & ''' where custid = ''' & $OldID & ''' update subset set custid = ''' & $NewID & ''' where custid = ''' & $OldID & '''"', "" )

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...