GlobaLevel
asked on
Hour date in 1:00 AM format fro ms sql server 2005
How do I conver this:
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
to this:
1:00 AM
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
to this:
1:00 AM
CONVERT(@CURR_DATE , GETDATE() , 108)
ASKER
is this right?
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
DECLARE @DAILY_CURR_DATE nvarchar(max)
SET @DAILY_CURR_DATE = select CONVERT(varchar, @CURR_DATE, 108)
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
DECLARE @DAILY_CURR_DATE nvarchar(max)
SET @DAILY_CURR_DATE = select CONVERT(varchar, @CURR_DATE, 108)
Remove the select
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
DECLARE @DAILY_CURR_DATE nvarchar(max)
SET @DAILY_CURR_DATE = CONVERT(varchar, @CURR_DATE, 108)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You can try this if you are working in SQL Server 2008.
DECLARE @CURR_DATE smalldatetime
SET @CURR_DATE = ISNULL(@CURR_DATE, getDATE())
select CONVERT(varchar,CONVERT(time,@CURR_DATE),100)
-- 11:46AM
try using convert
select CONVERT(varchar, @CURR_DATE, 108)