首页 > 代码库 > sql 查询列明为关键字加方括号---备忘

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.1411 -- Description:    根据条件获取来场登记列表12 -- =============================================13 ALTER PROCEDURE [dbo].[P_FrontCounter_GetCheckInfoByCondition]14 @Status int15 AS16 BEGIN17     --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 Checkin24     --exec (@sql)25 END26 --exec P_FrontCounter_GetCheckInfoByCondition @status=‘2‘

 

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