Hej!
Jag har en SP som ser ut såhär
SELECT
fields
FROM
table
JOIN
this and that
ON
this and that
WHERE
this and that = this and that
Nu skulle jag vilja ha joinen innanför en ifsats exempelvs:
SELECT
fields
FROM
table
if @myVar = 0
BEGIN
JOIN
this and that
ON
this and that
END
WHERE
this and that = this and that
Men jag får bara fel när jag gör så, hur skall jag gå tillväga?