Tuesday, March 27, 2012

Field by Position

Hi, Nobody have idea to get a field in "select" statement by its position (without name then)?

My scope was to duplicate a row into a table with identity column getting all row except the identity one, that i want to provided by constant expression.

Bye and thanks...

:D :DYou will need to use dynamic SQL (constructing your SQL Statements at runtime) by referencing the database Schema or the sysobjects and syscolumns tables.|||Uhmmm...why do you need to do this...?|||Often I have duplicate row in table with a lot of columns ... and i wanted a statement to avoid to call each time columns by name ...

The real scope was to find a statement to say : "Get all the columns except primary key ... that I provide by constant expression ...."

Maybe the unique solution is to prepare a program to write statement how i need

Thanks|||why not just write the query with all the column names except the primary key?

that would've taken no more than a minute or two, a lot faster than writing a query to go against the system tables, and a lot faster than writing a program to do that

No comments:

Post a Comment