Reputation: 14835
I need to use the IDENT_CURRENT of a specific table inside a query I'm writing.
I don't want to do a query to store the ID and another query to use it. I'd like something like:
UPDATE my_table1
SET my_column1 = IDENT_CURRENT(my_table2)
WHERE my_column2 = ?
Is it possible?
Upvotes: 1
Views: 1823
Reputation: 776
Yes, this code will work fine.
Table name for the function IDENT_CURRENT
must be in quotas:
UPDATE my_table1
SET my_column1 = IDENT_CURRENT('my_table2')
WHERE my_column2 = ?
Upvotes: 1
Reputation: 4048
Needs quotes around table name.
UPDATE my_table1
SET my_column1 = IDENT_CURRENT('my_table2')
WHERE my_column2 = ?
Upvotes: 0