Intelligent Automation & Macro Software  

Go Back   Automation Anywhere, Inc. Forums > Products Zone > Automation Anywhere
Register FAQ Search Today's Posts Mark Forums Read

Automation Anywhere Post messages and questions related to Automation Software here.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2009, 12:49 PM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default SQL stored procedure call fails with string parameters with commas in them

I'm passing a string parameter to a stored procedure and the commas in my strings are causing problems. Any string with a comma in it causes the call to the stored procedure to fail... I assume it's thinking that the next variable starts as soon as it sees a comma even if it is contained in a single string.

How can pass a parameter with a comma in it to a stored procedure?

Thanks!

Tyler
Reply With Quote
  #2 (permalink)  
Old 12-07-2009, 02:25 PM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

I am using variables to hold my strings and it isn't working...
Reply With Quote
  #3 (permalink)  
Old 12-08-2009, 04:42 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

To get around this, we can replace every occurrence of comma with space and then pass the modified string to stored procedure. We can use VB Script to replace the comma.

We have attached a sample task for your reference. To run this task,

. Please copy .atmn under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder.
. Copy .mdb under C:\stored_procedure folder.
. Copy .vbs under C:\.

Hope that helps.
Attached Files
File Type: zip stored_procedure.zip (22.8 KB, 5 views)
Reply With Quote
  #4 (permalink)  
Old 12-08-2009, 08:04 AM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

Thanks for the reply. I may not have been clear in my initial message. I wasn't looking for a way to remove commas from my strings. I was asking for a way to get strings with commas into my stored procedure... I need the commas.

One way I can think of would be to replace all commas with a unique string, like "[;]", then within the procedure you could convert all instances of those back to commas, but that is a really hacky workaround and is prone to errors.

Is there a reason commas aren't allowed?

Can you think of a way to get commas into the stored procedures?
Reply With Quote
  #5 (permalink)  
Old 12-15-2009, 12:35 PM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 102
Default

Just put "" around the field. If the field you're trying to write to is a text field then the DB (depending on which one) will usually interpret the comma as the start of a new field, if its numerical usually it depends on the DB type. To be safe, place "" around every value you want to pass. It works for me with DBs such as MS Access where I can run a procedure directly within Access no problem, but from AA it requires quotes.
Reply With Quote
  #6 (permalink)  
Old 12-17-2009, 09:55 AM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

Thanks Trent!

I think I've tried this already but I'll double check and report back.

I am using SQL Server 2008.

Tyler
Reply With Quote
  #7 (permalink)  
Old 12-17-2009, 02:15 PM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

Ya, I just tried that again and it doesn't work with quotes around the string. I made a test task and I tried doing the following tests, non of them worked:

-- TEST 1 (how i think it should work)--
usp_mySprocName('$Prompt-Assignment$')

where $Prompt-Assignment$ =

My string, with comma.

-- TEST 2 --
usp_mySprocName("$Prompt-Assignment$")

where $Prompt-Assignment$ =

My string, with comma.

-- TEST 3 --
usp_mySprocName($Prompt-Assignment$)

where $Prompt-Assignment$ =

"My string, with comma."

-- TEST 4 --
usp_mySprocName($Prompt-Assignment$)

where $Prompt-Assignment$ =

'My string, with comma.'
Reply With Quote
  #8 (permalink)  
Old 12-17-2009, 04:36 PM
trentonponder trentonponder is offline
Senior Member
 
Join Date: Jan 2009
Posts: 102
Default

Try running SQL directly from AA and compare results.
Reply With Quote
  #9 (permalink)  
Old 12-18-2009, 04:03 AM
forumsupport forumsupport is offline
Senior Member
 
Join Date: Apr 2007
Posts: 1,342
Default

Hello,

You can try this,

. Instead of comma (,) use colon (: ) as a part of parameter string.
. Insert Replace function in stored procedure to convert every colon of parameter string into comma.

We have attached a sample task that works with Oracle successfully.

Please copy .atmn under location, 'C:\...\My Documents\Automation Anywhere\Automation Anywhere\My Tasks' folder.

Query.txt contains the syntax to create stored procedure.

Hope that helps.
Attached Files
File Type: zip StoredProc.zip (947 Bytes, 2 views)
Reply With Quote
  #10 (permalink)  
Old 12-21-2009, 08:26 AM
TylerMitton TylerMitton is offline
Senior Member
 
Join Date: Nov 2009
Posts: 102
Default

Ya, that's what I said in my third post of this thread...
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -7. The time now is 05:08 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc.
Copyright © 2003-2011 Automation Anywhere, Inc. All rights reserved