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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Trigger or something else

Author  Topic 

dewacorp.alliances

452 Posts

Posted - 2003-01-12 : 17:51:11
Hi all

I had table structure like this:

ChartAccountID; varchar(8)
RegionID; varchar(2)
DivisionID; varchar(2)
LocationSiteID; varchar(2)
ServiceTypeID; varchar(2)

I want to be able when inserting or updating this table automatically populate the ChartAccountID with concanate string between RegionID + DivisionID + LocationSiteID + ServiceTypeID.

So for instance if the data reading for Ms Accel file containng RegionID, DivisionID, LocationSiteID, and ServiceType -> 01, D1, L2, S2 .. will automatically populate ChartAccountID with 01D1L2S2.

Any ideas the best thing to do with this? Is the trigger is only the way? How do you this?

Thanks.


ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-12 : 18:17:23
you can also use a computed column take a look at BOL

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-01-12 : 19:09:10
Or just calculate it when presenting the data.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

afterburn
Starting Member

28 Posts

Posted - 2003-01-17 : 20:51:38
or just add another feild that has the formula of the value

Go to Top of Page
   

- Advertisement -