首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求解·没法绑定有多个部分组成的标识符

2013-02-19 
求解·····无法绑定有多个部分组成的标识符USE DP6_SiemensGO/****** Object:StoredProcedure [dbo].[Extra

求解·····无法绑定有多个部分组成的标识符

USE DP6_Siemens
GO

/****** Object:  StoredProcedure [dbo].[ExtraProc_JD]    Script Date: 02/04/2013 09:58:45 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:<W>
-- Create date: <Create Date,,>
-- Description:<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[ExtraProc_SR]
-- Add the parameters for the stored procedure here
@NewSmsId BIGINT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @CorpId INT , @Mobile  VARCHAR(15)
SET @CorpId = 1

SELECT @Mobile = Mobile
FROM DP_SmsInProcess
WHERE NewSmsId = @NewSmsId
--------------------------------------- 
IF DP_SmsInProcess.Content LIKE '%SR激活%'
BEGIN
INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel , AttemptTimes , Operator)
SELECT @CorpId AS CorpId , 
   @Mobile AS Mobile , 
   '西门子dp平台提醒:您的激活信息已收到,请耐心等待dp客服给您发出的资料核实,谢谢!' AS CONTENT , 
   dbo.GetSmsChannelByMobile(@Mobile , @CorpId) AS SendChannel ,
   0 AS AttemptTimes ,
   'SR_Remind' AS Operator
   END
   
---------------------------------------------   
    IF dbo.DP_SmsInProcess.Content LIKE '%SR调岗%'
    BEGIN
    INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel , AttemptTimes , Operator)
SELECT @CorpId AS CorpId , 
   @Mobile AS Mobile , 
   '西门子dp平台提醒:您的调岗信息已收到,请耐心等待dp客服给您发出的资料核实,谢谢!' AS CONTENT , 
   dbo.GetSmsChannelByMobile(@Mobile , @CorpId) AS SendChannel ,
   0 AS AttemptTimes ,
   'SR_Remind' AS Operator
   END
------------------------------------------------------   
IF dbo.DP_SmsInProcess.Content LIKE '%SR更换手机%'
    BEGIN
    INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel , AttemptTimes , Operator)
SELECT @CorpId AS CorpId , 
   @Mobile AS Mobile , 
   '西门子dp平台提醒:您的更换手机信息已收到,请耐心等待dp客服给您发出的资料核实,谢谢!' AS CONTENT , 
   dbo.GetSmsChannelByMobile(@Mobile , @CorpId) AS SendChannel ,
   0 AS AttemptTimes ,
   'SR_Remind' AS Operator
   END
----------------------------   
    IF dbo.DP_SmsInProcess.Content LIKE '%SR更换手机号码%'
    BEGIN
    INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel , AttemptTimes , Operator)


SELECT @CorpId AS CorpId , 
   @Mobile AS Mobile , 
   '西门子dp平台提醒:您的更换手机号码信息已收到,请耐心等待dp客服给您发出的资料核实,谢谢!' AS CONTENT , 
   dbo.GetSmsChannelByMobile(@Mobile , @CorpId) AS SendChannel ,
   0 AS AttemptTimes ,
   'SR_Remind' AS Operator
   END 
   
----------------------  
    IF dbo.DP_SmsInProcess.Content LIKE '%SR离职%'
    BEGIN
    INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel , AttemptTimes , Operator)
SELECT @CorpId AS CorpId , 
   @Mobile AS Mobile , 
   '西门子dp平台提醒:您的离职信息已收到,请耐心等待dp客服给您发出的资料核实,谢谢!' AS CONTENT , 
   dbo.GetSmsChannelByMobile(@Mobile , @CorpId) AS SendChannel ,
   0 AS AttemptTimes ,
   'SR_Remind' AS Operator
   END  
    

    -- Insert statements for procedure here
END


--[ExtraProc_JD] 76506
--SELECT * FROM DP_SmsInProcess dsip WHERE dsip.Instruction = 'JD' AND dsip.Mobile = '13640782588'
GO




提示是这样的求解·没法绑定有多个部分组成的标识符
我的疑问是,上面明明有那个表啊,也有表中的列,怎么就无法识别呢?是语法不正确么?求解,各位大神
[解决办法]
没有这种语法,表的字段只能用在DML中
[解决办法]
你只是中间的提示有变化,可以用case when选择将不同文字的便量传入,如

INSERT INTO DP_SmsOutQueue(CorpId , Mobile , [Content] , SendChannel,AttemptTimes , Operator)
    SELECT @CorpId,Mobile,
case when Content LIKE '%SR激活%' then @content1
when Content LIKE '%SR调岗%' then @content2
when Content LIKE '%SR更换手机号码%' then @content3
when Content LIKE '%SR更换手机%' then @content4
when Content LIKE '%SR离职%' then @content5
end
,dbo.GetSmsChannelByMobile(@Mobile , @CorpId),0,'SR_Remind'
FROM DP_SmsInProcess
    WHERE NewSmsId = @NewSmsId

热点排行
Bad Request.