Click here to Skip to main content
15,888,610 members
Home / Discussions / Database
   

Database

 
QuestionSql server like clause Pin
rubonkumar28-Dec-12 4:44
rubonkumar28-Dec-12 4:44 
AnswerRe: Sql server like clause Pin
Richard MacCutchan28-Dec-12 6:05
mveRichard MacCutchan28-Dec-12 6:05 
AnswerRe: Sql server like clause Pin
PIEBALDconsult28-Dec-12 6:38
mvePIEBALDconsult28-Dec-12 6:38 
GeneralRe: Sql server like clause Pin
Mike Meinz28-Dec-12 6:49
Mike Meinz28-Dec-12 6:49 
GeneralRe: Sql server like clause Pin
rubonkumar28-Dec-12 19:08
rubonkumar28-Dec-12 19:08 
AnswerRe: Sql server like clause Pin
rajarao3044-Jan-13 0:50
rajarao3044-Jan-13 0:50 
QuestionDatabase design question Pin
David Crow27-Dec-12 15:22
David Crow27-Dec-12 15:22 
AnswerRe: Database design question Pin
PIEBALDconsult27-Dec-12 15:52
mvePIEBALDconsult27-Dec-12 15:52 
Instead of having one price record per item, have many records with history so you can see what the price was when the order was placed.

Something like:
Item: ItemId,Name,Description,Supplier,etc.

1,Widget,A standard widget,Widget Co,...

ItemPrice: PriceId,ItemId,FromDate,ToDate,Price

1,1,2012-01-01,2012-07-01,1.00<br />
2,1,2012-07-01,null,1.50


When a new price is added, the FromDate of the new record and the ToDate of the previous price are set as Now.
You find the current price by WHERE ToDate IS NULL
To find a price for an order you can use WHERE orderdate BETWEEN FromDate and ISNULL(ToDate,Now)
You may add NextPrice and PreviousPrice fields if you need to do a lot of lookups.

(Specific syntax depends on the particular database in use.)
AnswerRe: Database design question Pin
jschell28-Dec-12 10:16
jschell28-Dec-12 10:16 
GeneralRe: Database design question Pin
PIEBALDconsult28-Dec-12 14:42
mvePIEBALDconsult28-Dec-12 14:42 
GeneralRe: Database design question Pin
jschell30-Dec-12 8:28
jschell30-Dec-12 8:28 
AnswerRe: Database design question Pin
Mycroft Holmes28-Dec-12 11:05
professionalMycroft Holmes28-Dec-12 11:05 
QuestionImporting of Huge fixed width text file in sql server table Pin
ibrahim sharief27-Dec-12 9:24
ibrahim sharief27-Dec-12 9:24 
AnswerRe: Importing of Huge fixed width text file in sql server table Pin
PIEBALDconsult27-Dec-12 14:08
mvePIEBALDconsult27-Dec-12 14:08 
AnswerRe: Importing of Huge fixed width text file in sql server table Pin
Deepak Kr130-Dec-12 20:29
Deepak Kr130-Dec-12 20:29 
AnswerRe: Importing of Huge fixed width text file in sql server table Pin
jschell31-Dec-12 9:14
jschell31-Dec-12 9:14 
Questionshow Sum(Balance) as ob on Rows Header and add next rows balance in ob Pin
hadeed147227-Dec-12 6:52
hadeed147227-Dec-12 6:52 
AnswerRe: show Sum(Balance) as ob on Rows Header and add next rows balance in ob Pin
Corporal Agarn27-Dec-12 7:53
professionalCorporal Agarn27-Dec-12 7:53 
GeneralRe: show Sum(Balance) as ob on Rows Header and add next rows balance in ob Pin
hadeed147227-Dec-12 8:03
hadeed147227-Dec-12 8:03 
QuestionSQL BulkCopy using IDataReader - how can you cast the fields? Pin
Allan Watkins26-Dec-12 19:12
Allan Watkins26-Dec-12 19:12 
AnswerRe: SQL BulkCopy using IDataReader - how can you cast the fields? Pin
Mycroft Holmes26-Dec-12 20:32
professionalMycroft Holmes26-Dec-12 20:32 
GeneralRe: SQL BulkCopy using IDataReader - how can you cast the fields? Pin
AllanW1111127-Dec-12 6:02
AllanW1111127-Dec-12 6:02 
AnswerRe: SQL BulkCopy using IDataReader - how can you cast the fields? Pin
PIEBALDconsult27-Dec-12 8:48
mvePIEBALDconsult27-Dec-12 8:48 
QuestionSubquery returns more than 1 row Pin
Jassim Rahma24-Dec-12 1:02
Jassim Rahma24-Dec-12 1:02 
AnswerRe: Subquery returns more than 1 row Pin
Eddy Vluggen24-Dec-12 1:29
professionalEddy Vluggen24-Dec-12 1:29 

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.