Sign in to follow this  
Followers 0
McGyver

Problem running OSQL

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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''"', "" )

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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 & '''"', "" )

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks :idea: That did the trick. I think working while sick clogs the brain a bit.

Share this post


Link to post
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
Sign in to follow this  
Followers 0