SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Hungarian notation convention


Hungarian notation convention

Author
Message
NicHopper
NicHopper
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2888 Visits: 1944
Hi everyone,

Does anyone know where I can find a list of SQL data types and their Hungarian notation convention prefixes?

I can find them for VB but not for SQL Server.

Thanks,

Jackal.

------------------------------------------------------------
Check out my blog

http://www.sqlservercentral.com/articles/Best+Practices/61537/
GSquared
GSquared
SSC Guru
SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)

Group: General Forum Members
Points: 56565 Visits: 9730
I don't think there's a standard reference.

What I've seen, when I've seen it, has been:

int
tint
sint
bint

dtm
sdtm

vc
nvc

char
nchar

dec
num

flt

I don't use these, but they're what I've seen someone else use.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
NicHopper
NicHopper
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2888 Visits: 1944
Thanks GSquared.

I've been looking all morning, with no joy.

These should do me.

Thanks again.

------------------------------------------------------------
Check out my blog

http://www.sqlservercentral.com/articles/Best+Practices/61537/
GSquared
GSquared
SSC Guru
SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)SSC Guru (56K reputation)

Group: General Forum Members
Points: 56565 Visits: 9730
You're welcome.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)

Group: General Forum Members
Points: 210925 Visits: 41973
Gosh... you can use Hungarian notation if you want, but I think it's a real PITA. Let's say you have a table called something like tbl_MyTable. Someone redesigns a part of the system and the powers that be decide to use an indexed view instead of a table... and you have hundreds of stored procedures and GUI code instances where the code says "tbl_MyTable". Now what? You have 3 choices... find and change ALL the SQL Server and GUI code to the name of the new view, have a view with the "tbl_" prefix, or have a synonym (or passthrough view) named after a table even though it's a view.

My recommendation is to never use Hungarian notation in SQL Server. It's just not needed and can be a real PITA if certain changes are required. Smile

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
NicHopper
NicHopper
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2888 Visits: 1944
Hi Jeff,

Thanks for the reply, I am in complete agreeance with you. I've just been tasked with investigating it's usage potential.

Jackal

------------------------------------------------------------
Check out my blog

http://www.sqlservercentral.com/articles/Best+Practices/61537/
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)

Group: General Forum Members
Points: 210925 Visits: 41973
Heh... include my post in your report on usage potential advising against using it.

The only time I even come close to Hungarian notation is that I'll use a "pi" or "po" prefix on parameters in long stored procedures just to make the parameters easier to identify on long procs.... but I darned sure won't prefix one with something like "i" or "int" because even variables and parameters can change requirements of time. Imagine having a bunch of GUI or T-SQL that passes named parameters to a proc and ultimately ending up thinking something was other than an Int because even though the data type for the variable changed, you couldn't change the name of the parameter for fear of breaking GUI code that did use named parameters.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Jim Russell-390299
Jim Russell-390299
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2199 Visits: 1403
Just don't do it! As usual, Jeff is right. (And it is one of the worst ideas MS ever came up with.)
MVDBA
MVDBA
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5417 Visits: 860
Agree Completely..

not just tables and views though - I've inherited a Database written by a .Net developer and all my columns have prefixes and suffixes

for example

Mytable_Mycolumns_tinyint

if i want to upgrade tinyint to int then my (inherited) app becomes a mess.... or i have to recode and recompile..

even worse it's not really readable - given that you may know that table customer has an age field

select max(tintage) from customer

is not really great!!! even worse you have to know the data type before you can query the column


one thing i can recommend though is try and use the Singular of Table and column names

i.e
Customer rather than customers
Hobby rather than Hobbies

yes the table is a collection of customer, but this can be easily confusing since apostrophee cannot be used in table names

customershobbies could referernce all customers' hobbies or a single customer's hobbies

instead stick to customerhobby

MVDBA
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)

Group: General Forum Members
Points: 210925 Visits: 41973
Holy Moly, Mike... I thought I had it bad and the current job...

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search