Click here to Skip to main content
15,899,026 members
Home / Discussions / Database
   

Database

 
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 
AnswerRe: How Much Space Is Wasted In Unused Fields In SQL Server? Pin
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 
When faced with a problem like this, I figure out what the largest record is for both character and numeric data (usually splitting the latter into integer and double). I then build a table with sufficient fields to handle the most complex of data, such that there is a field for every data item in each category, plus a field for item type.

These columns are then labelled as Text01...Textnn, Int01...Intnn and so on. Any text field that needs to be larger than 8 bytes is a VARCHAR, and is populated, by default, with a single space, not left at NULL. No columns permit NULL.

I then build a second table, with the same number of columns, but all CHAR, containing the column headers for each item type, with a one-to-many relationship to the item type in the main table. Each column name in the second table matches the corresponding column name in the main table. Each data item in the second table contains the 'friendly' name for the column in the main table, depending on the item type.

The SQL becomes somewhat more complex, but it is the most space-efficient method I have found to date, and there are (IMHO) considerable advantages in saving the entire inventory in a single table.
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 
QuestionDB2 Commands Pin
Manivannan Dheena17-Oct-11 19:17
Manivannan Dheena17-Oct-11 19:17 
AnswerRe: DB2 Commands Pin
Manivannan Dheena17-Oct-11 23:52
Manivannan Dheena17-Oct-11 23:52 
Questionisnull in linq where condition Pin
yesu prakash13-Oct-11 20:02
yesu prakash13-Oct-11 20:02 
AnswerRe: isnull in linq where condition Pin
Johan Hakkesteegt13-Oct-11 21:37
Johan Hakkesteegt13-Oct-11 21:37 

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.