¶ÁÊéÈË

Ϊʲô˵СµÜÎҵĶÔÏóÒÑ´æÔÚ

·¢²¼Ê±¼ä£º 2012-01-23 21:57:28 ×÷Õߣº rapoo

Ϊʲô˵ÎҵĶÔÏóÒÑ´æÔÚ£¿
ALTER PROCEDURE [dbo].[testProc]
AS
BEGIN
declare @test int;
select count(*) as c into test from table2;
print @test

END

¾Í¶¨ÒåÁËÒ»¸ötest±äÁ¿£¬µÚÒ»´ÎÖ´Ðд洢¹ý³ÌµÄʱºòºÃµÄ£¬µÚ¶þ´ÎÒÔºó¾Í²»ÐÐÁË£¬Ëµtest±äÁ¿ÒÑ´æÔÚ¡£¡£ÎªÊ²Ã´£¿»»ÁËÆäËûµÄ±äÁ¿ÃûͬÑù
ÎÒÖ±µ½Áãʱ±í¿ÉÒÔdrop table£¬±äÁ¿Ôõô°ìÄÄ£¿

[½â¾ö°ì·¨]
ALTER PROCEDURE [dbo].[testProc]
AS
BEGIN
if exists(select 1 from sysobjects where xtype= 'U ' and name= 'test ')
drop table test
declare @test int;
select count(*) as c into test from table2;
print @test

END

¶ÁÊéÈËÍø >SQL Server

ÈȵãÍÆ¼ö