Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What is the Qlikview syntax for SQL Server's DB_NAME()

I need to pull data from different databases.  There are no unique keys across the different databases.  I would like to create a unique key by concatenating the database name, which can be found using DB_NAME() in SQL Server, with the unique key found within the database.  Is there a way to pull data into Qlikview, directly from SQL Server and accomplish this?

Thanks in advance,

Anthony

2 Replies
Gysbert_Wassenaar

You can simply use the sql select statement you would use when working with SQL Server directly:

TableInQlikview:

select *, UniqueKey + DB_NAME() as Key

from dbo.TableInSQLServer;


talk is cheap, supply exceeds demand
Not applicable
Author

Hey Anthony,

If you want to create a unique key for a table, why don't you try using RowNo(). This will give a unique number for each row(it will also be sequential based on load order). Also when you pull the table you will be knowing which database you are pulling from. Just Create a field like 'Microsoft DB' as [DB Name] for each of the tables with their respective DB names. Store those tables in qvds and later use those qvds to perform your modelling

Hope this was of some help.

Thanks

AJ