J'ai une table nommée Table1
qui contient un ID
et TimeStamp
.TimeStamp dans SQL Server 2000
Structure de la table
ID TimeStamp
1 0x0000000000047509
Mais quand je compare la combinaison de ces champs, il montre toujours faux. Quelle est la raison pour ça?
Ma Recherche est:
DECLARE @ID int
DECLARE @TimeStamp timestamp
SET @ID = 1
SET @TimeStamp = 0x0000000000047509
If EXISTS(SELECT 1 FROM Table1 WHERE ID = @ID AND TimeStamP = @TimeStamp)
BEGIN
SELECT 1 AS RetVal
END
ELSE
BEGIN
SELECT -1 AS RetVal
END
Ma procédure stockée est comme suit
CREATE PROCEDURE [dbo].[Check] (
@XMLDoc ntext
)AS
BEGIN
SET NOCOUNT ON
SET XACT_ABORT ON
DECLARE @ID bigint
DECLARE @TimeStamp timestamp
DECLARE @hDoc int
EXEC sp_xml_PrepareDocument @hDoc OUT, @XMLDoc
SELECT @ID = ID
,@TimeStamp = [TimeStamp]
FROM OPENXML (@hdoc,'/XML')
WITH ( ID bigint 'ID'
,[TimeStamp] timestamp 'TStamp')
IF @@ERROR<>0
BEGIN
EXEC sp_xml_RemoveDocument @hDoc
SELECT -620 AS RetVal
RETURN
END
IF NOT EXISTS(SELECT 1 FROM Table1 WHERE ID= @ID AND Timestamp = @TimeStamp )
BEGIN
SELECT -1 AS RetVal
END
ELSE
BEGIN
SELECT 1 AS RetVal
END
END
il ne fonctionne pas pour moi dans Sql 2000.Have u la case est cochée en 2000? – Adu
@Adu - oui, cela a fonctionné pour moi aussi dans SQL 2000. Les types de données pour ID et Timestamp sont-ils respectivement 'int' et' timestamp'? – LittleBobbyTables
le type de données pour l'ID est bigint – Adu