Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the 'system()' function??

Status
Not open for further replies.

trumb1mj

MIS
Joined
Jun 29, 2006
Messages
12
Location
US
Hi everyone. First I will try and tell everyone what I am trying to do. I am trying to send an 'isql' command to the command line using perl. Would I want to use the system function for this? Here is my current code:

system (isql -S uschi00tst88 -U sa -P -d CTCMaster -Q "DELETE FROM CTCMaster..rtd_Instruments BULK INSERT CTCMaster..rtd_instruments FROM \"\\\\uschi00dev037\\TestDB\\TextFiles\\RTD_Instruments.txt\" WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = ';',KEEPIDENTITY, CHECK_CONSTRAINTS)");


Please, any help will be greatly appreciated. Thanks!
 
What's the problem you're having?
 
The problem is, the '\' are causing the perl script to think that an action should occur while I want to send what ever is in the () to the command line exactly how it appears.
 
Is system() used to send text to the command line?
 
Sorry about all the posts to my own post but this will be helpful.

The problem definitely is consecutive '\'. But thats the only way I could get this command to work from the command line. Please someone, is there an alternative for consecutive '\' in perl. Please help. Thanks!
 
I think the problem may be that you haven't escaped enough characters with \.

Try

Code:
system (isql -S uschi00tst88 -U sa -P -d CTCMaster -Q \"DELETE FROM CTCMaster..rtd_Instruments BULK INSERT CTCMaster..rtd_instruments FROM \"\\\\uschi00dev037\\TestDB\\TextFiles\\RTD_Instruments.txt\" WITH (FIELDTERMINATOR = \',\', ROWTERMINATOR = \';\',KEEPIDENTITY, CHECK_CONSTRAINTS)\");
 
Yeah, it was an escape issue. I solved the problem yesterday. Man can Perl be ugly at times! Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top