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 |
nietzky
Yak Posting Veteran
75 Posts |
Posted - 2015-05-08 : 03:23:34
|
I want to do a simple insert operation on small number of records (less than 200). The problem is I don't know what are the values for TYPE and HRNUM( these values are identity columns and are integers in tblTypes and in table tblHR ). I do know TYPE string ex. 'LOWER DD' but I need to resolve it to an int, HRNUM can be resolved by passed SID column and returning scalar value. TYPE can be resolvd by passing 'LOWER DD' value to a functionSID TYPE HRNUM IsAvailu3131 ? ? 0u3130 ? ? 0u7133 ? ? 0u8437 ? ? 0u3174 ? ? 0u8136 ? ? 0u2137 ? ? 0want to do something like this.insert into TargetTable ( TYPE, HRNUM, 0)select a.TYPE, a.HRNUM, 0from @MyTable aHow can I plug in scalar sql functions to this? Target table has identity column. |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-05-08 : 09:12:19
|
the short answer is Yes, you can use a scalar function to return the identity columns. For things like this, I usually just try it out and see what happens, then post my problem if it doesn't work right.Gerald Britton, MCSAToronto PASS Chapter |
|
|
|
|
|