>DECLARE @Time char(40) > >SET @Time='This is the time '+convert(varchar,datepart(hour,getdate()))+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(minute,getdate())),2)+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(second,getdate())),2) > >Raiserror(@Time,0,1) With Nowait >>
>DECLARE @Time char(40) > >SET @Time=convert(varchar,datepart(hour,getdate()))+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(minute,getdate())),2)+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(second,getdate())),2) > >Raiserror('This is the time '+@Time,0,1) With Nowait >>
>DECLARE @Time char(40) > >SET @Time=convert(varchar,datepart(hour,getdate()))+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(minute,getdate())),2)+':'+ > RIGHT(REPLICATE('0',2)+convert(varchar,datepart(second,getdate())),2) > >Raiserror('This is the time %s',0,1,@Time) With Nowait >Yes, exactly. The last approach will work. I remember long time ago (in 2003) I had the same frustration when I tried to use Raiserror the first time. Now I know about its "limitations" and either construct the whole string as a variable or embed values using parameters as BOL states. It would be nice to have a simpler syntax in future versions of SQL Server.