Code Base Management Scheme for various SQL Server Versions
How are people maintaining a code base for a product that has customers on various versions of SQL server?? I'm hoping its not all "lowest common denominator" for code because we would like to be able to provide customers that have SQL Server 2016 ... with that versions benefits .. while also supporting customers with SQL Server 2008. For example, a function that would return if a table is memory-optimized in 2016 might look like : CREATE FUNCTION is_memory_table ( @tableName sysName) RETURNS int AS BEGIN DECLARE @ReturnValue INT; SELECT @ReturnValue = is_memory_optimized FROM SYS.Tables WHERE name=@tableName; RETURN @ReturnValue; END However, this code would error in trying to Create it in 2008 because that is_memory_optimized flag doesn't exist. So you might have CREATE FUNCTION is_memory_table ( @tableName sysName) RETURNS int AS BEGIN RETURN 0; END So, How are people handling this kind of idea? It can be big and unrealistic to try to always have a script with code written with Dynamic SQL... but, at the same time... multiple files for the same object might not work either because of maintenance of the code base. If anyone has a link that I haven't found where this is discussed, I would love to investigate it.