I am new to both SQL 2005 and the corporate library (version 4.) I would call Stored Proc and pass a string longer than 8000 characters. The column in db is defined as varchar (max). I thought I would start with a little test first by calling the saved process from T-SQL, and I was surprised that the inserted string value was truncated even for a short string.
CREATE TABLE [dbo].[ChadTest](
[TestParam] [varchar](max) NOT NULL
) ON [CMISII_DATA]
GO
ALTER PROCEDURE [dbo].[spr_ChadTest]
(
@TestParam varchar(max)
)
AS
BEGIN
INSERT INTO ChadTest
(TestParam) VALUES (@TestParam)
END
DECLARE @RC int
DECLARE @TestParam varchar
SET @TestParam = '12345'
EXECUTE @RC = [CMISII].[dbo].[spr_ChadTest]
@TestParam
Select TestParam, len(TestParam) from chadtest
Conclusion:
1 1
As soon as I get this simple example above, I will need to figure out how to pass a long string to SP code from VB.NET code using the Enterprise library. What will be the data type of the parameter? I do not see the overloaded version of the AddInParameter method, which takes a length, and I do not see the enumeration "varchar (max)" as an available data type.
dbCmd = db.GetStoredProcCommand("spr_ChadTest")
db.AddInParameter(dbCmd, "TestParam", SqlDbType.VarChar, TestParam.ToString)
Thank!