select COUNT(*) from OPENQUERY(LinkName3, 'select bill_id from ILIMS_Customs.dbo.store_in_head where create_date>="2017-01-01 00:00:00.000" and status=5')
...全文
1785打赏收藏
在Sql Service中当Sql语句当成参数时,查询条件报错怎么弄
select COUNT(*) from OPENQUERY(LinkName3, 'select bill_id from ILIMS_Customs.dbo.store_in_head where create_date>="2017-01-01 00:00:00.000" and status=5')
select COUNT(*) from OPENQUERY(LinkName3, 'select bill_id from ILIMS_Customs.dbo.store_in_head where create_date>="2017-01-01 00:00:00.000" and status=5')
楼主好像输入的是一个双引号, 应该换成两个单引号, 两个。
SELECT
COUNT(*)
FROM
OPENQUERY
(LinkName3,
'select bill_id from ILIMS_Customs.dbo.store_in_head where create_date>=''2017-01-01 00:00:00.000'' and status=5'
);