Sql Server column vakue insert
Posted on 2011-10-01
In my sql server table these are the columns:
ID CategoryID Description code
Q101 cat1 VLC - 001 Example1 VLC - 001
Q102 cat1 VLC - 002 Example1 VLC - 002
Q103 cat2 PAY - 001 Example1 PAY - 001
When the user input data into this table:
(1) I wanted to generate this code depending on the CategoryID i.e. For Cat1 VLC - 001, VLC -002 and so forth
(2) For each row for the description I need to prefix the respective code for each row they insert into table.
This data input not through a application or anything like that but they will do it in the management studio so I wanted to do this in table level in the sql server. Can I create a function and attach to this column so every time the user add a new row and will use this function to generate next available code for that row and also prefix this description as well.
Any help would very greatly appreciated....