DECLARE @Sql NVARCHAR(MAX),@ReceiveID NVARCHAR(50)
SET @ReceiveID = ' WHERE AreaID = 11'
SET @Sql = 'SELECT * FROM dbo.Area_Info'
IF (ISNULL(@ReceiveID, '') <> '')
BEGIN
SET @Sql = @Sql +@ReceiveID
END
--PRINT @Sql
EXEC (@Sql)
T-SQL语句的拼接后,查询结果集
最新推荐文章于 2024-08-15 23:27:38 发布