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 2005 Forums
 Transact-SQL (2005)
 Toe the line.

Author  Topic 

nmarks
Yak Posting Veteran

53 Posts

Posted - 2007-11-07 : 09:30:04
Does anyone know if there's a quick way to make variable type declarations line up neatly?

In the example below all the variables are declared as integers (INT). Does SQL Server or Visual Studio have a facility to get these INTs to line up quickly?

DECLARE @age_val_life1 INT;
DECLARE @age_val_life2 INT;
DECLARE @age_val_life1_for_CC INT;
DECLARE @age_val_life2_for_CC INT;

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-07 : 09:33:48
what do you mean?
maybe something like:
DECLARE @age_val_life1 INT, @age_val_life2 INT, @age_val_life1_for_CC INT, @age_val_life2_for_CC INT;

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-07 : 09:38:51
Some sort of Pretty Print for SQL maybe?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-07 : 09:45:01
quote:
Originally posted by nmarks

Does anyone know if there's a quick way to make variable type declarations line up neatly?

In the example below all the variables are declared as integers (INT). Does SQL Server or Visual Studio have a facility to get these INTs to line up quickly?

DECLARE @age_val_life1 INT;
DECLARE @age_val_life2 INT;
DECLARE @age_val_life1_for_CC INT;
DECLARE @age_val_life2_for_CC INT;


Why does it matter?
Try here www.sqlinform.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nmarks
Yak Posting Veteran

53 Posts

Posted - 2007-11-07 : 09:49:27
Doh!

When I posted this question I puts lots of tabs all over the place so none of the INTs lined up - it was a real hotch-potch. Unfortunately I think this website's parser removed the duplicates!!

Nonetheless, the example as it appears above still suffices to understand the question: As it appears on screen above, what I'd really like is for all four INTs (or NVARCHARS or FLOATs or whatever) to line up in a column - pretty print as Kristen put it.

Can Server or Visual Studio do this with just the click of a mouse?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-07 : 09:50:34
no

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

nmarks
Yak Posting Veteran

53 Posts

Posted - 2007-11-07 : 09:51:54
It matters for ease of reading.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-07 : 09:52:16
If you expect this
DECLARE @age_val_life1        INT;
DECLARE @age_val_life2 INT;
DECLARE @age_val_life1_for_CC INT;
DECLARE @age_val_life2_for_CC INT;

Try the link I posted

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-11-07 : 12:07:21
Free:
http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl

e4 d5 xd5 Nf6
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-11-07 : 12:41:55
Visual Studio will do this for you. It has been too long for me to remember where to set that, however.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -