SELECT SEQ.NEXTVAL FROM DUAL
does sql server have anything similar?Do you tried 'Select SEQ.NEXTVAL' That should work!|||SQL Server does not have such virtual table for that exact purpose like oracle has, for example in Oracle you can run:
select sysdate from dual
Same would be in SQL Server:
select getdate()
e.g any virtual table is not needed, statement just consists of SELECT plus then a function or T-SQL specific stuff. With identities (same as sequences in Oracle) there are SCOPE_IDENTITY(), @.@.IDENTITY AND IDENT_CURRENT, for example to query current identity value:
SELECT IDENT_CURRENT('TABLE_NAME')
Exact difference with all three:
IDENT_CURRENT returns the last identity value generated for a specific table in any session and any scope.
@.@.IDENTITY returns the last identity value generated for any table in the current session, across all scopes.
SCOPE_IDENTITY returns the last identity value generated for any table in the current session and the current scope.
So to reply completely to your question, there are functions etc which do not need any virtual table when they are general (table-independant, querying the date is good example) and then there are stuff which need the table to be specified in the query like previous identity query.sql
No comments:
Post a Comment