Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter a stored procedure

Status
Not open for further replies.

OldSlowDog

Programmer
Mar 11, 2002
36
US
I have made some changes to an existing stored procedure. I pressed F5. I thought it should update my sp's content only and should not execute the statements in it. My question is does SQL Server execute the SELECT and stuff in the procedure when I pressed F5 with the ALTER statement?
Thanks.

ALTER PROCEDURE CollectSales
(
@Co int,
@Column int,
@SiteID int,
@BeginDate datetime,
@RtC int output
)
AS
SET NOCOUNT ON

INSERT INTO DailyRecords_tbl
SELECT @Co, @Column, @SiteID,
Convert(char(10), ClosingDate, 101), DailySales
FROM RegionSales
WHERE ClosingDate > @BeginDate

SET @RtC = @@ROWCOUNT
 
Executing SQL Statements in SQL Query Analyzer
You can execute a complete script or only selected SQL statements in SQL Query Analyzer.

Execute a complete script by creating or opening the script in the Editor pane and pressing F5.


Execute only selected SQL statements by highlighting the lines of code in the Editor pane and pressing F5.
You can also easily execute a SELECT statement containing a built-in function. Right-click the function in Object Browser, select Script Object to New Window As, and select Execute. A SELECT statement containing the function is displayed in a new Editor pane. If the function contains arguments, they are displayed in template parameter format. Press CTRL+SHIFT+M to display the Replace Template Parameters dialog box and supply values for the function arguments. Press F5 to execute the SELECT statement.

Straight out of BOL...


"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Execute a complete script by creating or opening the script in the Editor pane and pressing F5.

It does on my PC in SQL Server 2000.
Anyone know what the difference would be? [ponder]

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
OldSlowDog:

What did SqlServer Execute when you pressed F5

1)altered the Sp
2)set nocount on
3)insert records into DailyRecords_tbl

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top