select CONVERT(varchar(10), getDate(),120) --不要时间2002-1-1
select convert(char(8),getdate(),112) ----20020101
select convert(char(8),getdate(),108)  ---06:05:05

解决方案 »

  1.   

    你是要:select CONVERT(varchar(19), getDate(),120)
      

  2.   

    以'-'分隔:
      Select Convert(varChar(22),getdate(),20)以'\'分隔:
      Select Convert(varChar(22),getdate(),131)(2003-07-11 11:11:05.243)  =>(2003-07-11 11:11:05.000)
    Select Cast(Convert(varChar(19),getdate(),20) as DateTime)
      

  3.   

    你错了!时间不是以什么来分割,你看到的用什么来分割只是显示格式,上面都是改变显示格式你插入的时候如:declare @a datetimeset @a='2003-1-1'
    select @aset @a='2004-01-01'
    select @aset @a='2005/1/1'
    select @aset @a='20060101'
    select @a都是对的关键是外面要有'号
      

  4.   

    日期可以用各种格式输入,例如:
    declare @a datetime
    select @a='2003-01-01'
    ,@a='2003/01/01'
    ,@a='2003.01.01'
    ,@a='2003 01 01'结果都是一样的