Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-01-12 : 08:23:38
|
using a for each loop.This loop is looking at a folder on th enetwork and looping through all the .csv filesVariablemapping is set to user::FileNameNow I have an execute sql task inside the loop. In this task I havethe following sql:insert into tblMain(Name) values(?)The parameter mapping is set to be user::Filename varchar size 20But I get the following error when running this task.Do you see why please?ThanksError: String or binary data would be truncated.[Execute SQL Task] Error: Executing the query "insert into tblMain(Name) values (?)" failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-12 : 12:41:56
|
thats because the fieldlength set for Name field in tblMain is not sufficient to hold file path returned by the loop. First check if you've given enough length to Name field. Secondly check property inside for each loop to ensure its returning what you really want (ie filename only or filename with extension or fully qualified name)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2012-01-13 : 07:06:16
|
Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-13 : 09:56:28
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|