views:

225

answers:

2

I know there are several questions like this on here already, but I can't find one that relates to my problem.

I've got an SP declared like this:

CREATE PROC [dbo].[SomeProc]
(
  @param1 VARCHAR(255)
  , @param2 INT
  , @param3 VARCHAR(8)
)

When I add the Stored Procedure to the Data Model it generates the following signature:

int SomeProc(string param1, int? param2, string param3)

The problem I have is that if I use a parameter longer than 6 characters for param3 I always get the "String or Binary Data Would Be Truncated" error. To me it seems like it have something to do with double-byte vs single-byte strings, but I'm not really sure. It doesn't seem to work with other data types (NVarChar, Char, etc.) either though...

What is causing this and how can I fix it?

+1  A: 

Check the attributes on the generated method.

What else are you doing in the SP? It could be that you are getting that error further down.

leppie
Thanks, this was the problem. Somewhere deep inside the proc there was an insert being done into a table that had the column for that parameter declared with length=6.
ilitirit
A: 

Check the field length for those tables being updated

sam munkes