Quantcast
Channel: Getting started with SQL Server forum
Viewing all articles
Browse latest Browse all 9243

Can column default value be based in another column?

$
0
0

I have table Employee with two columns: [EmpCode] and [Dept].

Is it possible that [Dept]'s default value be some CASE statement that can be two possible values? If [EmpCode] begins with 'H' then [Dept] equals 'HR'. Otherwise, [Dept] equals 'ENG'.

Thanks.


VM


Viewing all articles
Browse latest Browse all 9243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>