日期:2014-05-18 浏览次数:20523 次
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER PROCEDURE [dbo].[SP_DEPOT_SELECT] @P_MobileId nvarchar(50) AS declare @sqlstr nvarchar(4000) DECLARE @PhoneCount int DECLARE @return_DateTime int declare @DepotCount int BEGIN --将这条操作数据标示为当前用户 begin tran set @sqlstr = '' set @sqlstr = 'UPDATE [Depot] with(rowlock) SET [LockFlag] = @P_MobileId, LockDate = getdate() WHERE ID=(SELECT top(1)Id FROM depot where [LockFlag] is null or [LockFlag] = ''''' exec sp_executesql @sqlstr,N'@P_MobileId nvarchar(50)',@P_MobileId commit END GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
ALTER PROCEDURE [dbo].[SP_DEPOT_SELECT] @P_MobileId nvarchar(50) AS declare @sqlstr nvarchar(4000) DECLARE @PhoneCount int DECLARE @return_DateTime int declare @DepotCount int BEGIN --将这条操作数据标示为当前用户 begin tran set @sqlstr = '' set @sqlstr = 'UPDATE [Depot] with(rowlock) SET [LockFlag] = @P_MobileId, LockDate = getdate() WHERE ID=(SELECT top(1)Id FROM depot where [LockFlag] is null or [LockFlag] = '''')' exec sp_executesql @sqlstr,N'@P_MobileId nvarchar(50)',@P_MobileId commit tran END
------解决方案--------------------
参考:
http://topic.csdn.net/t/20040417/18/2977759.html
如果数据库中执行正常的话,你有可能是在程序中被截断了,断点调试一下。