12
votes
2answers
8k views

What is the purpose of system table table master..spt_values and what are the meanings of its values?

What is the purpose of system table table master..spt_values? Why was it provided and how one should use it? What are the meanings of its type, low, high values? Update: Google search gives ...
1
vote
3answers
582 views

How to create multiple one to one's

I have a database set up with many tables and it all looks good apart from one bit... Inventory Table <*-----1> Storage Table <1-----1> Van Table ^ ...
43
votes
27answers
7k views

How do you like your primary keys? [closed]

In a fairly animated discussion in my team I was made to think what most people like as primary keys. We had the following groups- Int/ BigInt which autoincrement are good enough primary keys. There ...
51
votes
24answers
19k views

Use Float or Decimal for Accounting Application Dollar Amount?

We are rewriting our legacy Accounting System in VB.NET and SQL Server. We brought in a new team of .NET/ SQL Programmers to do the rewrite. Most of the system is already completed with the Dollar ...
57
votes
10answers
21k views

When/Why to use Cascading in SQL Server?

When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it? This probably applies to other databases as ...
30
votes
8answers
7k views

How do you effectively model inheritance in a database?

What are the best practices for modeling inheritance in databases? What are the trade-offs (e.g. queriability)? (I'm most interested in SQL Server and .NET, but I also want to understand how other ...
6
votes
4answers
3k views

Why (and how) to split column using master..spt_values?

Subquestioning the answer to question "Split one column into multiple rows" which I re-wrote here as [ 1 ]. What is the (meaning of) Type = 'P' and why to use undocumented master..spt_values for ...
40
votes
9answers
2k views

When is it better to store flags as a bitmask rather than using an associative table?

I’m working on an application where users have different permissions to use different features (e.g. Read, Create, Download, Print, Approve, etc.). The list of permissions isn’t expected to change ...
8
votes
13answers
2k views

Should I design a table with a primary key of varchar or int?

I know this is subjective, but I'd like to know peoples opinions and hopefully some best practices that I can apply when designing sql server table structures. I personally feel that keying a table ...
15
votes
5answers
5k views

How can you represent inheritance in a database?

I'm thinking about how to represent a complex structure in a SQL Server database. Consider an application that needs to store details of a family of objects, which share some attributes, but have ...
23
votes
8answers
23k views

How to store directory / hierarchy / tree structure in the database?

How do i store a directory / hierarchy / tree structure in the database? Namely MSSQL Server. @olavk: Doesn't look like you've seen my own answer. The way i use is way better than recursive queries ...
21
votes
6answers
31k views

Difference between clustered and nonclustered index

Ok, I'm in the middle of developing a project on my own (first time for me for this scale) and it started in a rush so my tables are kind of miserable. I need to add proper index' and need some help. ...
14
votes
12answers
5k views

What columns generally make good indexes?

As a follow up to "What are indexes and how can I use them to optimize queries in my database?" where I am attempting to learn about indexes, what columns are good index candidates? Specifically for ...
9
votes
5answers
41k views

How to call Stored Procedure in a View?

How would I call a Stored Procedure that returns data in a View? Is this even possible?
2
votes
5answers
953 views

Single or multiple databases

SQL Server 2008 database design problem. I'm defining the architecture for a service where site users would manage a large volume of data on multiple websites that they own (100MB average, 1GB ...

1 2 3 4 5 12
15 30 50 per page