Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Hungarian notation convention Expand / Collapse
Author
Message
Posted Wednesday, September 10, 2008 6:58 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 2:17 AM
Points: 1,516, Visits: 1,716
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/
Post #566838
Posted Wednesday, September 10, 2008 7:09 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Monday, November 17, 2014 12:50 PM
Points: 13,872, Visits: 9,598
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
Post #566849
Posted Wednesday, September 10, 2008 7:12 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 2:17 AM
Points: 1,516, Visits: 1,716
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/
Post #566853
Posted Wednesday, September 10, 2008 12:29 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Monday, November 17, 2014 12:50 PM
Points: 13,872, Visits: 9,598
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
Post #567202
Posted Monday, September 22, 2008 8:06 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:34 PM
Points: 35,609, Visits: 32,200
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. :)


--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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #573989
Posted Tuesday, September 23, 2008 1:48 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 2:17 AM
Points: 1,516, Visits: 1,716
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/
Post #574096
Posted Tuesday, September 23, 2008 7:41 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:34 PM
Points: 35,609, Visits: 32,200
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #574852
Posted Wednesday, September 24, 2008 5:44 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, July 30, 2010 11:27 AM
Points: 435, Visits: 1,403
Just don't do it! As usual, Jeff is right. (And it is one of the worst ideas MS ever came up with.)
Post #575083
Posted Wednesday, September 24, 2008 7:34 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 8, 2014 3:25 AM
Points: 2,283, Visits: 781
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
Post #575185
Posted Wednesday, September 24, 2008 6:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:34 PM
Points: 35,609, Visits: 32,200
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #575658
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse