使用Where错误

时间:2013-11-20 13:05:40

标签: sql sql-server-2008

'在MsSql新建。

Mysql命令是

EXEC('SELECT '+@columnnames +' From WindData Where 
  (TimeStamp between '''+@startdate+''' and '''+@finishdate+''') 
and (DATEPART(second,TimeStamp) = ''00'') 
and (DATEPART(minute,TimeStamp) = ''15'' 
    or DATEPART(minute,TimeStamp) = ''30'' 
    or DATEPART(minute,TimeStamp) = ''45'' 
    or DATEPART(minute,TimeStamp) = ''00''
    ) 
order by TimeStamp') 

我的Sql查询无效。我想我不使用正确和/或联合。 请帮帮我。

0 个答案:

没有答案