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
 SQL Server Development (2000)
 Why do i get 19 Spaces using case

Author  Topic 

Clages1
Yak Posting Veteran

69 Posts

Posted - 2010-09-17 : 12:16:00
Hi
in this script in the else condition
i get 19 spaces , but i need None
this is to create a TXT file with Pipes

|2010-09-17 13:15:21|

or
||

how can i do this?
tks
Clages



declare @x char(10)
set @x = 'xxxx'
select
case
when @x = 'SCAN900'
then convert(char(19),getdate(),120)
else ''
end

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-17 : 12:26:39
[code]
declare @x char(10)
set @x = 'xxxx'
select
case
when @x = 'SCAN900'
then convert(varchar(19),getdate(),120)
else ''
end
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Clages1
Yak Posting Veteran

69 Posts

Posted - 2010-09-17 : 13:34:43
I am used to use char and forgot varchar
tks a lot

clages
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-18 : 09:08:11
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -