06/11/2013, 17:57
|
| | | Fecha de Ingreso: septiembre-2012
Mensajes: 450
Antigüedad: 12 años, 2 meses Puntos: 3 | |
Respuesta: Procedimiento almacenado con errores ayudita Amigo actualmente lo tengo asi el procedimiento: Cita: CREATE PROCEDURE [dbo].spSEARCH_MAS
@Player VARCHAR(10),
@Name VARCHAR(50),
@LastName VARCHAR(50),
@Email VARCHAR(50),
@Password VARCHAR(50),
@Phone VARCHAR(50),
@Zip VARCHAR(50),
@Status CHAR(1),
@LoginDateStart VARCHAR(25),
@LoginDateEnd VARCHAR(25),
@Ip VARCHAR(15),
@WebSite INT,
@Success CHAR(1)
AS
BEGIN
DECLARE @CREATE_TLB_TEMP NVARCHAR(MAX) -- QUERY TO CREATE THE TEMPORARY TABLE
DECLARE @QUERY_SEARCH NVARCHAR(MAX) -- QUERY THAT PERFORMED THE SEARCHING
IF OBJECT_ID('tempDB..#PlayerTemp','U') IS NOT NULL
DROP TABLE #PlayerTemp;
SET @CREATE_TLB_TEMP = 'SELECT IdPlayer, Player, Name, LastName, Email, Password, IdBook INTO #PlayerTemp FROM PLAYER '
IF @Status <> 'E' OR @Status <> 'D' BEGIN
SET @CREATE_TLB_TEMP = @CREATE_TLB_TEMP + 'WHERE Player LIKE '+@Player+' AND Name LIKE '+@Name+'
AND LastName LIKE '+@LastName+' AND Email LIKE '+@Email+'
AND Password LIKE '+@Password+' AND Phone LIKE '+@Phone+'
AND Zip LIKE '+@Zip
END
ELSE BEGIN
SET @CREATE_TLB_TEMP = @CREATE_TLB_TEMP + 'WHERE Player LIKE '+@Player+' AND Name LIKE '+@Name+'
AND LastName LIKE '+@LastName+' AND Email LIKE '+@Email+'
AND Password LIKE '+@Password+' AND Phone LIKE '+@Phone+'
AND Zip LIKE '+@Zip+' AND Status = '+@Status
END
EXEC sp_executesql @CREATE_TLB_TEMP
END Al ejecutarlo de esta forma: Cita: EXEC [dbo].spSEARCH_MAS '%%','%test%','%%','%%','%%','%%','%%','D','2013-09-01 00:00:00','2013-11-06 15:45:00','%%',0,'Y' Me da este error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'AND'.
Última edición por adryan310; 06/11/2013 a las 18:26 |