Time DataType in Sql Server 2005

后端 未结 3 702
别跟我提以往
别跟我提以往 2020-12-18 15:08

I\'ve created small database under SQL Server 2008. Now i wanted to move it to SQL Server 2005 and it doesn\'t work since it doesn\'t have Ti

3条回答
  •  独厮守ぢ
    2020-12-18 15:25

    Sadly, there is no Time datatype in SQL Server 2005. What I would suggest doing to convert your existing data to your SQL Server 2005 Instance is use something like this:

    Select CONVERT(DateTime, YourDateTimeColumn, 114) AS [HH:MI:SS:MMM(24H)]
      From YourTable
    

    This will give your the current date WITH the time from the existing data. You will have to just strip the date of the time somehow when retrieving the data. This can be done using a Format function in C# (or whatever .NET language you might be using... assuming you are doing that)

    Hope that helps.

提交回复
热议问题