-
stored procedure drops the leading zero while executing
I have created an insert stored procedure as follows
ALTER PROCEDURE dbo.rcPersistOrderDetail
(
@Store AS varchar(5),
@tDate AS varchar(8),
@ToB AS varchar(2),
@UVNDCDE AS varchar(8),
@QUANTITY AS varchar(8)
)
AS
BEGIN
Declare @SQL VarChar(1000)
SELECT @SQL = 'INSERT INTO [' + @Store + '] (Store, tDate, ToB, UVNDCDE, QUANTITY) '
SELECT @SQL = @SQL + ' Values(' + @Store + ',' + @tDate + ',' + @ToB + ','
SELECT @SQL = @SQL + @UVNDCDE + ',' + @QUANTITY + ')'
Exec(@SQL)
END
RETURN
When this stored procedure is executed for example with
the following insert values
8888, 08252005 ,14,124,5
the inserted result is
8888, 8252005 ,14,124,5
Yes, the tDate field in the table is defined as varchar(8).
I am using c# and ado.net to execute the stored procedure.
When I define the ado.net command as of type command text
and actually assign the sql statement to the command object,
I get the desired result. I just can't figure out why the stored procedure would behave differently. Please help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|