Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Using SqlCmd variables in a database project

$
0
0

Does anyone know if it's possible to use SqlCmd Variables in a stored procedure within a database project?

For example I've added a $NewType SqlCmd variable to my database project. And set this variable to 'VARCHAR'.

But when I try and use this in a stored procedure in the project:

DECLARE @ClientName $(NewType) (100)

the project won't build, giving me a syntax error near @ClientName. I have SqlCmd mode turned on via VS SQL menu.

A similar example works in SQL Management Studio:

:setvar VARCHARTYPE "VARCHAR"

ALTER TABLE tempTable ADD newColumn $(VARCHARTYPE)(200);


Does anyone know why VS won't build the project and if there's a way around it?


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>