Cannot create database from InstallShield SQL script

exec xp_cmdshell 'net use \\\\pcname\\v360_database_backup localpass /user:domain\\localuser';

use master;
FROM DISK = '\\\\pcname\\v360_database_backup\\v360_233_06042010.bak' WITH RECOVERY,  
   MOVE 'v360' TO 'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\v360_22_t291.mdf',
   MOVE 'v360_log' TO 'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\v360_22_t291_log.ldf';

Hi all.
I can sucessfully run this script directly from SQL Server.
When I run it from InstallShield view "Server Configuration --> SQL Scripts" it gives no result -- no database created and no error shown.
If I run any other code from there like, create db user or update table it produces result correctly.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
>> SQL Scripts" it gives no result -- no database created and no error shown.

Definitely a permissions issue
Kindly check the credentials used for creating database using the above script.
Syntax of Above script is fine.
mirik123Author Commented:
When I run it from command line it also works.
May be InstallShield uses its own SQL engine?

C:\Program Files\Microsoft SQL Server\90\Tools\Binn>sqlcmd -S pcname01 -U sa -P sapass -i D:\sql.sql
The command completed successfully.
(0 rows affected)
Changed database context to 'master'.
(0 rows affected)
Processed 2144 pages for database 'v360_22', file 'v360' on file 1.
(0 rows affected)
Processed 8 pages for database 'v360_22', file 'v360_log' on file 1.
RESTORE DATABASE successfully processed 2152 pages in 10.297 seconds (1.711 MB/sec).
mirik123Author Commented:
This code works well from IS but it throws some unknown error in try/catch.

set conn = CoCreateObject("ADODB.Connection");
sConnString = "Provider=SQLOLEDB;User ID="+strusr+";password="+strpsw+";Data Source="+strsrv;
sExecString =
   "exec xp_cmdshell 'net use \\\\pcname\\v360_database_backup winpass /user:winuser';"+
   "use master;"+
   "RESTORE DATABASE v360_22 "+
   "FROM DISK = '\\\\itnvis\\v360_database_backup\\v360_233_06042010.bak' WITH RECOVERY,"+  
   "MOVE 'v360' TO 'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\v360_22.mdf',"+
   "MOVE 'v360_log' TO 'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\DATA\\v360_22_log.ldf';";
   res = conn.Open(sConnString);
      if (res < 0) then
         MessageBox("Connection open failed: " + str2,MB_OK);
   res = conn.execute(sExecString);
    set conn = NOTHING;
       MessageBox("Error setting database", MB_OK);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mirik123Author Commented:
And this is also working :)

sExecString =
"declare @datalog varchar(250),@datamdf varchar(250), @data_path varchar(250);"+
"Select @data_path=Reverse(substring(ltrim(reverse([FileName])),charindex('\\',Ltrim(reverse([Filename]))),datalength(Ltrim(reverse([Filename]))))) From sysfiles Where groupid = 1;"+
"set @datamdf = @data_path + '"+strdb+".mdf';"+
"set @datalog = @data_path + '"+strdb+"_log.ldf';"+
"exec xp_cmdshell 'net use \\\\"+pcname+"\\nav360_database_backup "+strsharepass+" /user:"+strshareuser+"';"+
"use master;"+
"RESTORE DATABASE "+strdb+" "+
"FROM DISK = '\\\\"+pcname+"\\v360_database_backup\\"+strsharefile+"' WITH RECOVERY,"+  
"MOVE 'nav360' TO @datamdf,"+
"MOVE 'nav360_log' TO @datalog;";
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.