I have a scenario where there is a table and i nned to pass table values param inside one of the stored procedure to peform certain actions . Basic table structure is as follows.
CREATE TABLE [dbo].[CitytTax] (
[CountryCode] [int] NOT NULL,
[TaxType] [varchar](255) NULL
)
As you see, Taxtype column is varchar type and takes upto 255 chars. However I will create on table type as below in part of application code and pass this table type as param to one of sp.
DECLARE @TaxDetails as [CitytTax]
Now i will insert some dummy values into it and pass this table type to one of the SP.
INSERT INTO @TaxDetails ([CountryCode],TaxType )
VALUES (6047,'Codfggtuioanoio charge to fund the liquidation of insurancevalues')
but getting error as below :
String or binary data would be truncated
The question here is table value type is having a column which is similar to actual database table. SO when i insert above script, it fails. However if i insert any value to [taxtype] which is less than 50 characters, it will insert successfully. but fails for more than 50 chars. IM wondering why it fails,it is supposed to take upto 255 characters right??