sql - Use as in select statement on select statement -
i have request select statement works in oracle, when execute in sql server throws exception; request :
select non_existant (select rownum non_existant ,cab, validite tmp_rapprochement) validite '%non_existant%'
the error :
msg 207, niveau 16, État 1, ligne 2 nom de colonne non valide : 'rownum'.
thank you.
the error says rownum
not valid column name (i'm glad google translate there help)
msg 207, level 16, state 1, line 2 invalid column name 'rownum'.
you need fix error first - make sure columns select
's list defined in table.
once out of way, need provide alias inner select, this:
select non_existant (select rownum non_existant ,cab, validite tmp_rapprochement) x -- x above alias, mandatory in sql server syntax. validite '%non_existant%'
edit appears porting query oracle, rownum
not real column. in case should replace row_number
function, this:
select non_existant (select row_number() on (order cab) non_existant , cab -- ^^^ put rapprochement's primary key there , validite tmp_rapprochement ) x -- x alias, mandatory in sql server syntax. validite '%non_existant%'
Comments
Post a Comment