请教下:_RecordsetPtr pPtr;
...
_variant_t varTestTime;
...
varTestTime = pPtr->GetCollect("testtime");其中testtime在数据库SqlServer2000中,数据类型是smalldatetime。通过以上的代码查到的时间字符串,如“2010-6-11 01:01:01”,并不是我想要的。我的应用程序需要“2010-06-11 01:01:01”,主要是方便排序使用。请高人指点一下。多谢。

解决方案 »

  1.   

    select convert(varchar(19),getdate(),120)/*
                        
    ------------------- 
    2010-06-17 18:07:24(所影响的行数为 1 行)
    */
      

  2.   


    declare @a smalldatetime
    set @a='2010-6-11 01:01:01'
    select CONVERT(varchar(19),@a,120)(无列名)
    2010-06-11 01:01:00
      

  3.   

    都会带0的啊,你的为什么不带?
    select GETDATE()2010-06-17 18:09:54.710