I am wondering:
how to define data type and size from a format function call ?
If I define a view like this one, or similar .. then the column resulting from the format statement is a nvarchar(4000) ..
create view
[Clinical].[AAA_Scratch_View]
as
select
format ( getdate() , 'yyyy-MM-dd HH:mm:ss') as [getdateoutput]
If I am wanting a varchar(19) then this seems to work .. Is this the best way / only way ?
alter view
[Clinical].[AAA_Scratch_View]
as
select
CONVERT(VARCHAR(19), format ( getdate() , 'yyyy-MM-dd HH:mm:ss') ) as [getdateoutput]