Click here to Skip to main content
15,895,797 members
Home / Discussions / Database
   

Database

 
QuestionSQL Express to Access Pin
Kschuler23-May-06 8:29
Kschuler23-May-06 8:29 
AnswerRe: SQL Express to Access Pin
Eric Dahlvang23-May-06 9:29
Eric Dahlvang23-May-06 9:29 
QuestionBest way to get Today in DateTime Pin
Rob Philpott23-May-06 7:07
Rob Philpott23-May-06 7:07 
AnswerRe: Best way to get Today in DateTime Pin
Eric Dahlvang23-May-06 8:00
Eric Dahlvang23-May-06 8:00 
GeneralRe: Best way to get Today in DateTime Pin
Rob Philpott23-May-06 8:07
Rob Philpott23-May-06 8:07 
GeneralRe: Best way to get Today in DateTime Pin
Eric Dahlvang23-May-06 8:29
Eric Dahlvang23-May-06 8:29 
QuestionInserting Image in my Report (ReportViewer) Pin
anderslundsgard23-May-06 4:28
anderslundsgard23-May-06 4:28 
QuestionProgrammatically Updating a Table with Detail from derived from another Table Pin
AnneThorne23-May-06 3:45
AnneThorne23-May-06 3:45 
Hi,

We are creating an ASP Database Application that connects to Sql Server 2000.

The application is for associating a zip code with a warehouse. For instance a zip code for the los angeles area would go to the los angeles warehouse and a zip code for the new york area would go to the new

york warehouse. We would like to enter zip code ranges into the following Wzip_Log table. Then we would like to programmatically populate the Wzip_Detail table and the Wzip table.

The Wzip_Log table holds zip code ranges, where as the Wzip_Detail and the Wzip table hold individual zip codes.

For instance, the Wzip_Log table might have the following record (completely fictitious)
Wzip_Log_ID: 1
PostalCode_Start: 11111
PostalCode_End: 11113
CountryCode: USA
WarehouseNum: 1
Operator: jdoe
Time_Stamp: 00:00:00 6/1/2006

Then we would want the Wzip_Detail table to be populated as follows:
Wzip_Detail_ID: 1
Wzip_Log_ID: 1
PostalCode: 11111
CountryCode: USA
WarehouseNum: 1

Wzip_Detail_ID: 2
Wzip_Log_ID: 1
PostalCode: 11112
CountryCode: USA
WarehouseNum: 1

Wzip_Detail_ID: 3
Wzip_Log_ID: 1
PostalCode: 11113
CountryCode: USA
WarehouseNum: 1

The Wzip table would be populated exactly the same as the Wzip_Detail table at this point.

However, say a user later updated the Wzip_Log table as follows:
Wzip_Log_ID: 2
PostalCode_Start: 11111
PostalCode_End: 11113
CountryCode: USA
WarehouseNum: 2
Operator: jdoe
Time_Stamp: 01:10:00 6/4/2006

The Wzip_Detail table would contain an INSERT of this data (giving it a total of 6 records)
whereas the Wzip table would contain an UPDATE of this data (giving it a total of 3 records)


For your reference, here are the table layouts:


Table Name: Wzip_Log

Wzip_Log_ID int 4 (primary key, Identity)
PostalCode_Start varchar 10
PostalCard_End varchar 10
CountryCode varchar 3
WarehouseNum int 4
Operator varchar 50
Time_Stamp datetime 8

Table Name: Wzip_Detail

Wzip_Detail_ID int 4 (primary key, Identity)
Wzip_Log_ID int 4 (foreign key)
PostalCode varchar 10
CountryCode varchar 3
WarehouseNum int 4


Table Name: Wzip

Wzip_ID int 4 (primary key, Identity)
Wzip_Log_ID int 4 (foreign key)
Wzip_Detail_ID int 4 (foreign key)
PostalCode varchar 10
CountryCode varchar 3
WarehouseNum int 4


I think there is probably some way to do this programmatically in Sql Query Analyzer, but are not sure how, so I thought I would ask you here who have helped me tremendously in the past.

I am eager to learn more about writing such functions and am enjoying this project.

Thanks in advance for any help you can give,
Anne
QuestionData base connection problem Pin
iz723-May-06 2:28
iz723-May-06 2:28 
QuestionSQL Server does not exist or access denied [modified] Pin
sarah_chandran23-May-06 0:57
sarah_chandran23-May-06 0:57 
AnswerRe: SQL Server does not exist or access denied [modified] Pin
sathish s23-May-06 2:11
sathish s23-May-06 2:11 
GeneralRe: SQL Server does not exist or access denied [modified] Pin
sarah_chandran23-May-06 3:14
sarah_chandran23-May-06 3:14 
Questionwriting query using comma separator Pin
dayakar_dn23-May-06 0:09
dayakar_dn23-May-06 0:09 
AnswerRe: writing query using comma separator [modified] Pin
Frank Kerrigan23-May-06 0:46
Frank Kerrigan23-May-06 0:46 
Questionado.net Pin
ravikiranreddydharmannagari22-May-06 23:22
ravikiranreddydharmannagari22-May-06 23:22 
AnswerRe: ado.net Pin
dayakar_dn23-May-06 1:49
dayakar_dn23-May-06 1:49 
Questionhow to make one column as a index Pin
dayakar_dn22-May-06 20:58
dayakar_dn22-May-06 20:58 
AnswerRe: how to make one column as a index Pin
Eric Dahlvang23-May-06 9:21
Eric Dahlvang23-May-06 9:21 
QuestionAction Queries [modified] Pin
xfitr222-May-06 5:31
xfitr222-May-06 5:31 
AnswerRe: Action Queries [modified] Pin
Colin Angus Mackay22-May-06 6:49
Colin Angus Mackay22-May-06 6:49 
GeneralRe: Action Queries [modified] Pin
xfitr222-May-06 7:31
xfitr222-May-06 7:31 
QuestionSQL Performance problem need help Pin
Pallav Deshmukh22-May-06 3:32
Pallav Deshmukh22-May-06 3:32 
AnswerRe: SQL Performance problem need help Pin
woudwijk22-May-06 5:23
woudwijk22-May-06 5:23 
GeneralRe: SQL Performance problem need help Pin
Pallav Deshmukh22-May-06 20:15
Pallav Deshmukh22-May-06 20:15 
AnswerRe: SQL Performance problem need help Pin
Colin Angus Mackay22-May-06 5:24
Colin Angus Mackay22-May-06 5:24 

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.