Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
salto
Specialist II
Specialist II

Generate table key on LOAD

Hello,

I am loading a SQL table that has no keys. It is not a problem in itself, but I would like to add a key field on load time (something simple, like an autonumeric field):

TableWithNoKeys:

LOAD MyAutomericFieldThatIdentifiesTheLoadedRecord,

field1, field2, ..., fieldN;
SQL SELECT *
FROM "Database".dbo."TableWithNoKeys";

Can I create such a field? Many thanks in advance.

1 Solution

Accepted Solutions
sparur
Specialist II
Specialist II

Hello, Salto

You could use RowNo() function for create incremental index for each row.

Like as:

LOAD Field1, Filed2, RowNo() as KeyLineNum

;

SQL SELECT,,,

See more details in reference manual or internal help system.

View solution in original post

2 Replies
sparur
Specialist II
Specialist II

Hello, Salto

You could use RowNo() function for create incremental index for each row.

Like as:

LOAD Field1, Filed2, RowNo() as KeyLineNum

;

SQL SELECT,,,

See more details in reference manual or internal help system.

salto
Specialist II
Specialist II
Author

Perfect! Thank you.