Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Declare Performance

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2006-12-03 : 21:10:48

IS there any performace difference by using

DECLARE @main_name VARCHAR(100)
DECLARE @main_input_parameters VARCHAR(500)

DECLARE @sp_name VARCHAR(500)
DECLARE @input_parameters VARCHAR(500)
DECLARE @ref_table_name VARCHAR(100)
DECLARE @executed_action VARCHAR(10)

AND USING like

DECLARE @main_name VARCHAR(100),@main_input_parameters VARCHAR(500),@sp_name VARCHAR(500),@input_parameters VARCHAR(500),@ref_table_name VARCHAR(100),@executed_action VARCHAR(10)

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-12-03 : 21:37:01
Why don't you time it and tell us ?


Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2006-12-03 : 21:47:16
I tried using

SELECT getdate()
DECLARE @main_name VARCHAR(100)
DECLARE @main_input_parameters VARCHAR(500)

DECLARE @sp_name VARCHAR(500)
DECLARE @input_parameters VARCHAR(500)
DECLARE @ref_table_name VARCHAR(100)
DECLARE @executed_action VARCHAR(10)
SELECT getdate()

SELECT getdate()
DECLARE @main_name VARCHAR(100),@main_input_parameters VARCHAR(500),@sp_name VARCHAR(500),@input_parameters VARCHAR(500),@ref_table_name VARCHAR(100),@executed_action VARCHAR(10)
SELECT getdate()

But didn't give me a difference So little confused
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-12-03 : 21:58:00
Then I think you answered your own question

If there is a difference, it's not measurable.


Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-12-04 : 08:44:17
quote:
Originally posted by sqllearner


DECLARE @main_name VARCHAR(100),@main_input_parameters VARCHAR(500),@sp_name VARCHAR(500),@input_parameters VARCHAR(500),@ref_table_name VARCHAR(100),@executed_action VARCHAR(10)



Funny, I've been using SQL Server now for 8 years or so, and I've never known that you can declare more than 1 variable like that .... good to know, that will save some typing!

- Jeff
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-12-04 : 11:03:10
I lay mine out like this because I think its a bit easier to read, and it makes the DECLARE stand out more:

DECLARE @main_name VARCHAR(100),
@main_input_parameters VARCHAR(500),
@sp_name VARCHAR(500),
@input_parameters VARCHAR(500),
@ref_table_name VARCHAR(100),
@executed_action VARCHAR(10)

Kristen
Go to Top of Page
   

- Advertisement -