Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jim_jim
Constraint Violating Yak Guru
306 Posts |
Posted - 2011-09-07 : 11:07:41
|
| I have created a table called Tracking in our database to load data from access.The data in access is imported from another source which has all the data needed to load except for Reqno column which has to be generated based on a number in another table in the database called CustomerHistory.So after I load the data from accees to the tracking table i would have to generate Reqno column sequentially for the data loaded based on the value+5 in another table Table Definition for CustomerHistoryCREATE TABLE [dbo].[Tracking]( [ReqNo] [int] NULL, [Promonth] [datetime] NULL, [Hrno] [int] NULL, [customerno] [int] NULL, [submissiondt] [datetime] NULL, [confirmeddt] [datetime] NULL, [Customerprice] [money] NULL, [customercount] [int] NULL)Table Definition for customerHistoryCREATE TABLE [dbo].[customerHistory]( [table_name] [char](25) NOT NULL, [customerId] [int] NULL) |
|
|
ashishseo
Starting Member
1 Post |
Posted - 2011-09-08 : 07:48:12
|
| How to create table?Ashish kunar |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-09-08 : 07:53:19
|
| Is CustomerID in customerHistory supposed to be used for this? If not, how do the tables relate? |
 |
|
|
Lucian
Starting Member
1 Post |
Posted - 2011-09-09 : 05:49:37
|
| Add an Identity column (ID int identity(1,1) to the Tracking table.Do loadUpdate Tracking set ReqNo = ID + @Value + 5Drop Identity column if you want toNot the most elegant solution, but it will do the job |
 |
|
|
|
|
|