How to add 1 day to current date and have result in format yyyymmdd in SQL Server? -
i need add 1 day current date , have output in format yyyymmdd. code needs written on stored procedure on sql server.
currently code follows:
declare @dat date select @dat = dateadd(dd, 1, getdate()) select @dat =left(convert(varchar(8), @dat, 112),10)
however, seems im doing wrong output on sql table in format yyyy-mm-dd. need rid of hyphens.
any suggestions guys? in advance.
the issue assigning date object. need assign varchar.
i did following in sql server 2005:
declare @dat datetime declare @string varchar(8) set @dat = getutcdate() select @dat = dateadd(dd, 1, getdate()) select @string =convert(varchar(8), @dat, 112) print @string
Comments
Post a Comment