Sybase--动态改变存储过程里查询的数据库
declare @sql varchar(500)select @sql='select * from '+@dbName+'..tableName'--此句用于执行拼接好的SQL语句exec(@sql)例二:declare @sql2 varchar(max)declare @str1 varchar(20)set @str1='年龄'select @sql2='select Name as 姓名,Age as '+@str1+ case when 1<2 then ',Sex' else '' end+ ' from CBO_Person'exec(@sql2)