The idea is:
Currently, the MS SQL node requires you to specify the database name in the credential. We can modify the MS SQL node to add the database name as a field. This would allow users to use previous node results to change the context.
My use case:
In Azure SQL databases, the USE
statement is not available. You cannot switch between database from within the TSQL query.
I think it would be beneficial to add this because:
This would allow users on Azure SQL databases to change database context easily.
Any resources to support this?
- “In Azure SQL Database, the database parameter can only refer to the current database. If a database other than the current database is provided, the
USE
statement does not switch between databases”
USE (Transact-SQL) - SQL Server | Microsoft Learn - "Each single database is isolated, using a dedicated database engine. "
What Is a Single Database? - Azure SQL Database | Microsoft Learn
Are you willing to work on this?
I made the following as a workaround for myself: GitHub - necbricard/n8n-nodes-azuresql. It is based on the MSSQL node and credentials. I added the database name field in the node.ts and added functions to override the database name in the credentials.
displayName: 'Database Name',
name: 'database',
type: 'string',
default: '',
description: 'Name of the database to use. If not specified, the default database from credentials will be used.',
placeholder: 'Leave blank to use default from credentials',