title: How to execute sql file using another sql file MSQL
body: <p>Im creating database which need few sql scripts. Running them one by one is not effective , so I wanted to create main sql query which will load all files. I tried this :</p>
  
  <pre><code> Declare
   @DBServerName Varchar(100),
   @DBName Varchar(100), 
   @FilePathName Varchar(100),
   @strSql varchar(1000)
  
   Set @DBServerName='USER-PC'-- Server Name
   Set @DBName='testo' -- DB Name
   Set @FilePathName='some path here'
  
   Set @strSql= 'sqlcmd -S ' + @DBServerName + ' -d ' + @DBName + ' -i ' +        @FilePathName
  
   EXEC xp_cmdshell @strSql
  </code></pre>
  
  <p>After executing this, It is showing that my query was executed succesfully but in my database nothing is appearing. Ive seen lot of websites but there is no working answear.</p>