Home Forums SQL Server 2008 SQL Server 2008 - General Creation of dynamic sql query to create a select statement to pick a unique record RE: Creation of dynamic sql query to create a select statement to pick a unique record

  • @dwain.c

    I can Use IF/Else but there i'll have to use too many iterations,

    Because @Country and @province may contain more that one value.

    and each table City, Region, Country and Province contains a translation and also a synonym table.

    It will make too many iterations.

    @SpringTownDBA

    In this solution how can i pass multiple values in parameter

    declare @p1 varchar(100) = 'Evere,anvers'

    select top 10 *

    from TB_City ci

    where (@p1 is null or @p1 =ci.CityDefaultName)

    option (recompile)