sql 查询列明为关键字加方括号---备忘

 1 USE [Golf73_BJSY]
 2 GO
 3 /****** Object:  StoredProcedure [dbo].[P_FrontCounter_GetCheckInfoByCondition]    Script Date: 11/18/2014 11:38:50 ******/
 4 SET ANSI_NULLS ON
 5 GO
 6 SET QUOTED_IDENTIFIER ON
 7 GO
 8 -- =============================================
 9 -- Author:        王光旭
10 -- Create date: 2014.11.14
11 -- Description:    根据条件获取来场登记列表
12 -- =============================================
13 ALTER PROCEDURE [dbo].[P_FrontCounter_GetCheckInfoByCondition]
14 @Status int
15 AS
16 BEGIN
17     --declare @sql varchar(2000)
18     --set @sql=‘select ID, Status, CardNo, MemNo, GuestName, [Identity],
19     --StrategyCode, Sex, BoxNo, BagNo,CreateTime,
20     --CheckinTime, Creator, CheckOutTime, CheckoutUser,
21     --LastEditTime, LastEditor ,ExpiryDate, MainCardNo,
22     --SalemanCode  from Checkin where Status=‘+CAST(@Status as varchar(10))+‘‘
23     select top 20 * from Checkin
24     --exec (@sql)
25 END
26 --exec P_FrontCounter_GetCheckInfoByCondition @status=‘2‘

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。