Skip to content
Advertisement

SET parameters to microsoft SQL server to set environment

I have created some microsoft SQL server queries to insert values into some of my tables created. Below are the sql queries i used.

Above is a piece of code which i have used for dev environment. Same code with prod instead of dev should be used for production.

Is there any way to parameterize dev and prod to achieve this?

For example lets take a single query as below:

Expected output for prod is as below:

YES I cpould use notepad to find and replace dev with prod, but the ultimate aim is to keep a common code that can be used in different environments.

I have tried as below:

Tried with

Am getting the output as a string, not executing the query. how to execute this query part? Instead of SELECT do we need to ADD some other command?

Any leads appreciated!

Advertisement

Answer

You can try this:

Snapshot: enter image description here

Updated Query:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement