Click here to Skip to main content
15,887,683 members
Home / Discussions / Database
   

Database

 
QuestionRemove empty spaces in a String in TSQL Pin
Vimalsoft(Pty) Ltd20-Oct-11 2:08
professionalVimalsoft(Pty) Ltd20-Oct-11 2:08 
AnswerRe: Remove empty spaces in a String in TSQL Pin
Blue_Boy20-Oct-11 2:15
Blue_Boy20-Oct-11 2:15 
GeneralRe: Remove empty spaces in a String in TSQL Pin
Vimalsoft(Pty) Ltd20-Oct-11 2:36
professionalVimalsoft(Pty) Ltd20-Oct-11 2:36 
GeneralRe: Remove empty spaces in a String in TSQL Pin
Blue_Boy20-Oct-11 2:43
Blue_Boy20-Oct-11 2:43 
GeneralRe: Remove empty spaces in a String in TSQL Pin
PIEBALDconsult20-Oct-11 4:28
mvePIEBALDconsult20-Oct-11 4:28 
AnswerRe: Remove empty spaces in a String in TSQL Pin
PIEBALDconsult20-Oct-11 2:40
mvePIEBALDconsult20-Oct-11 2:40 
AnswerRe: Remove empty spaces in a String in TSQL Pin
RobLazarus31-Oct-11 21:29
RobLazarus31-Oct-11 21:29 
QuestionHow Much Space Is Wasted In Unused Fields In SQL Server? Pin
Roger Wright19-Oct-11 19:21
professionalRoger Wright19-Oct-11 19:21 
I've been toying with an inventory tracking program for my company for years, but I keep getting stuck on decisions I'm not smart enough to make. I really hate wasted space, and try to optimize table structures to contain only the fields they need, but that means that I'll need a custom table for almost every item in inventory, and that's a nightmare. In this particular dilemma (there are others), I don't know what happens with unused fields when records are stored in a SQL Server database. Do they take up space, or are records compressed when fields are left empty?

For example, we have transformers. They can be substation or distribution transformers, they can be pad-mounted or pole-mounted, they can be oil-filled or dry, they all have primary and secondary voltages, as well as kVA ratings. Any of them can have de-energized tap changers (DETC) which can change their voltage ratios, but which can only be changed while the transformer is off. Substation transformers can also have Load Tap Changers (LTCs), which can be changed on the fly in response to load changes, which can cause the output voltage to vary. If equipped with a LTC, the data collected for a transformer every month has to include how many steps it has moved, and its high and low step values.

My dilemma is that, if I try to create a Transformer table with every possible parameter to be recorded for every transformer, most records will contain a bunch of empty fields. If I try to create a schema that includes a separate table for every variation of transformer type, I'll have to manage a dozen or more different tables, not only in my database, but in the code that accesses it.

From a coding standpoint, a single master Transformer table is far easier to manage, and is the approach I'd prefer to follow. But if 90% of the transformers in use have 40% of their data fields set to null, will they still consume the same storage space as they would if all fields contained data? Will I be taking a performance hit by using the single, universal table structure? Or is it really worth the effort to create different tables for each possible configuration, and to provide customized code to manipulate each table?
Will Rogers never met me.

AnswerRe: How Much Space Is Wasted In Unused Fields In SQL Server? PinPopular
Mycroft Holmes19-Oct-11 20:17
professionalMycroft Holmes19-Oct-11 20:17 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Chris Meech20-Oct-11 4:01
Chris Meech20-Oct-11 4:01 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Roger Wright20-Oct-11 5:21
professionalRoger Wright20-Oct-11 5:21 
AnswerRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Chris C-B19-Oct-11 22:30
Chris C-B19-Oct-11 22:30 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Roger Wright20-Oct-11 5:27
professionalRoger Wright20-Oct-11 5:27 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Chris C-B20-Oct-11 6:01
Chris C-B20-Oct-11 6:01 
AnswerRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Eddy Vluggen20-Oct-11 2:09
professionalEddy Vluggen20-Oct-11 2:09 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Roger Wright20-Oct-11 5:28
professionalRoger Wright20-Oct-11 5:28 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Eddy Vluggen20-Oct-11 8:01
professionalEddy Vluggen20-Oct-11 8:01 
AnswerRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
jschell20-Oct-11 9:05
jschell20-Oct-11 9:05 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
Roger Wright20-Oct-11 10:25
professionalRoger Wright20-Oct-11 10:25 
GeneralRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
jschell21-Oct-11 10:54
jschell21-Oct-11 10:54 
QuestionSQL Query Select Pin
reogeo200817-Oct-11 21:26
reogeo200817-Oct-11 21:26 
AnswerRe: SQL Query Select Pin
Blue_Boy17-Oct-11 22:34
Blue_Boy17-Oct-11 22:34 
GeneralRe: SQL Query Select Pin
AditSheth17-Oct-11 23:09
AditSheth17-Oct-11 23:09 
AnswerRe: SQL Query Select PinPopular
Mycroft Holmes17-Oct-11 22:53
professionalMycroft Holmes17-Oct-11 22:53 
AnswerRe: SQL Query Select Pin
Niladri_Biswas26-Oct-11 16:27
Niladri_Biswas26-Oct-11 16:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.