0

I am using format in a stored procedure. My problem is that on the server the SQL Server version is old, and format() does not work. My use:

FORMAT([Data], 'dd.MM.yyyy')

where data is: 2008-10-31 00:00:00.000

How can I use convert() to obtain the same result?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
S.over17
  • 199
  • 2
  • 2
  • 14

1 Answers1

3

That is the format mysteriously called "104". You can use:

select convert(varchar(10), data, 104)

The mysteries of the format codes are explained in the documentation.

You can use this in any version of SQL Server. format() is much saner but only available since SQL Server 2012.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786