krunal pande

krunal pande

  • NA
  • 101
  • 28.1k

I have one query regarding dynamic database.

Nov 14 2017 11:03 PM
Hi team,
 
I have one query regarding dynamic database.
I put database name in one variable and i want to pass that variable in place of (elcm_mahsqa) , how to pass that variable i tried but it throws error.
Please suggest solution. 
 
SET @dbname=@OrganizationName
select 'ELCM_'+ @dbname '@dbname'
---------------------------------------employee id -------------------------------------------
set @EmpCode=(Select distinct(empcode) as empcode from elcm_mahsqa.tna.rostering where EmpCode=@EmpCode )

Answers (3)