Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL Task only passing first character of string to procedure Expand / Collapse
Author
Message
Posted Monday, March 4, 2013 12:17 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 2:29 PM
Points: 541, Visits: 1,050
I've created an ADO.Net connection to a SQL 2005 instance and am using a Execute SQL Task to pass two parameters. FileName (ie. aadc_test) and FilePath (ie. \\\\remoteserver\\directory) to a procedure.

The first parameter is defined as string (255) and the second as string (1000) in both the task and the database has those fields as nvarchar(255) and nvarchar(1000) respectively.

When the procedure runs it will insert the filename and path into the database but ONLY THE FIRST CHARACTER. So I'll get "a" and "\" in my fields.

Can anyone tell me why I'm only getting the first character of my strings?

Thanks,
Erin
Post #1426403
Posted Monday, March 4, 2013 12:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:23 AM
Points: 5,074, Visits: 11,852
What are the parameters defined as in the stored proc definition?


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1426405
Posted Monday, March 4, 2013 12:25 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:23 AM
Points: 12,915, Visits: 32,074
a parameter declared like DECLARE @var NVARCHAR or DECLARE @var2 VARCHAR has a size of ONE character...I think that's what Phil is going after...bad definition in the Stored procedure.

you would want to explicitly define the size, if that's the case. @var NVARCHAR(255) or whatever is appropriate.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1426406
Posted Monday, March 4, 2013 12:36 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 2:29 PM
Points: 541, Visits: 1,050
Booyah, Lowell! You hit it. I forgot to define the size of my stored proc variables.

Good catch!
Post #1426411
Posted Monday, March 4, 2013 12:38 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:23 AM
Points: 5,074, Visits: 11,852
Lowell (3/4/2013)

--
..I think that's what Phil is going after...bad definition in the Stored procedure.
--


It was indeed



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1426414
Posted Monday, March 4, 2013 3:28 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:22 PM
Points: 37,061, Visits: 31,624
Erin Ramsay (3/4/2013)
Booyah, Lowell! You hit it. I forgot to define the size of my stored proc variables.

Good catch!


IIRC, that maximum size for a DOS Path is 512 bytes. Not sure what it is for a UNC but I'd bullet proof the code a bit by making the variables on both ends with a width of at least 512 or maybe even 1024.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1426490
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse