Click to See Complete Forum and Search --> : SQLserver nvarchar size


bloke
11-13-2003, 05:43 AM
Hi guys

I'm using this stored procedure:

CREATE PROCEDURE sp_Purchase_Req
@fields nvarchar(4000),
@values nvarchar(4000)

AS
DECLARE @sql nvarchar(4000)

SET @sql = N'INSERT INTO EXT_Purchase_req (' +
@fields + N') VALUES (' + @values + ')'

Execute sp_executesql @sql

SELECT @@IDENTITY as requisitionID
GO

To insert a varying number of items into a varying number of fields. It works great. Or rather it did until I had to add a textarea field to the preceeding form. The form and sp still work however depending on the size of the input, I'm running out of space and getting an error message saying that the data will be truncated.

I didn't actually write the sp and don't profess to be an expert in sql but I'm assuming I need to change the datatypes to varchar(8000)?

Any assistance would be gratefully received!

Cheers