
28/09/2006, 17:18
|
 | Colaborador | | Fecha de Ingreso: abril-2003
Mensajes: 12.106
Antigüedad: 21 años, 10 meses Puntos: 25 | |
Un ejemplo del BOL vale más que mil palabras (digo, teclazos  ):
Código:
DECLARE @IntVariable INT
DECLARE @SQLString NVARCHAR(500)
DECLARE @ParmDefinition NVARCHAR(500)
/* Build the SQL string once.*/
SET @SQLString =
N'SELECT * FROM pubs.dbo.employee WHERE job_lvl = @level'
SET @ParmDefinition = N'@level tinyint'
/* Execute the string with the first parameter value. */
SET @IntVariable = 35
EXECUTE sp_executesql @SQLString, @ParmDefinition,
@level = @IntVariable
/* Execute the same string with the second parameter value. */
SET @IntVariable = 32
EXECUTE sp_executesql @SQLString, @ParmDefinition,
@level = @IntVariable
__________________ "El hombre, en su orgullo, creó a Dios a su imagen y semejanza."Friedrich Nietzsche |