USE [DB_NAME]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [DBO].[PROC_TEST_IF_BEGIN END]ASBEGINSET NOCOUNT ON;IF (DAY(GETDATE())=1)BEGINPRINT 'A'ENDIF (DAY(GETDATE())=19)BEGINPRINT 'A19'ENDIF (DAY(GETDATE())=20)BEGINPRINT 'AAAA20'ENDIF OBJECT_ID('TEMPDB..#BASE') IS NOT NULLBEGINPRINT 'B'ENDEND
假设今天是19号, 执行存储过程 EXEC PROC_Test_IF_BEGIN END
得到什么?
答案:a19