Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Varchar problem

Author  Topic 

acko
Yak Posting Veteran

52 Posts

Posted - 2003-08-28 : 10:24:05
Hi
I have the folowing stored proc.

CREATE PROC NewDoc
@Vrsta nvarchar(3),
@Sifra int OUTPUT
AS

INSERT Doc(Vrsta)
VALUES ( @Vrsta)

SELECT @Sifra = @@IDENTITY

declare @sifra int
exec novidokument '06', @sifra output
print @sifra

The field Vrsta in table Doc is varchar(3), but after insert into the table the value in the table is not 06 then 6. The same thing is with everty string containing zero on the begining.
How can i resolve this problem?
Thanks
Alex

mr_mist
Grunnio

1870 Posts

Posted - 2003-08-28 : 11:06:59
Are you sure the column isn't an int?

select convert(nvarchar(3),'06')

-- 06

select convert(int,convert(nvarchar(3),'06'))

-- 6

-------
Moo. :)
Go to Top of Page
   

- Advertisement -