I created Sql Server Database Project in Visual Studio and i wonder if there is possible to use something like this
pre deployment script
:setvar Environment Production
post deployment script
IF '$(Environment)' = 'Production'
BEGIN
ALTER VIEW [dbo].[vwTable]
AS
SELECT Col1, Col2 FROM Production.database.dbo.Table1
GO
END
ELSE
BEGIN
ALTER VIEW [dbo].[vwTable]
AS
SELECT Col2, Col3, Col4 FROM LinkedServer.Development.database.dbo.Table2
GO
END
error is : Alter view must be the only statement in the batch.
or simplier version
ALTER VIEW [dbo].[vwTable]
AS
IF '$(Environment)' = 'Production'
SELECT Col1, Col2 FROM Production.database.dbo.Table1
ELSE
SELECT Col2, Col3, Col4 FROM LinkedServer.Development.database.dbo.Table2
GO
error is : Incorrect syntax near IF. Expecting Select or With
any idea, what is your approach ?

IFcondition in SQL ServerVIEW.VIEWinSQLCMDmode, which has to decide which statement to execute based on the environment? I don't believe that.