Solved

How to open sql server management studio by using sql server authenticaion by using vba

Posted on 2016-09-16
16
44 Views
Last Modified: 2016-09-16
Hi Experts,

I am using below code to open ssms by using windows authenticion. But how can i open ssms by using sql server authenticaion via vba. Please anyone tell me the solution.

 Sub Open_ModScript()
    Dim rc
       rc = Shell("ssms.exe -S CHNMCT123456D -d sample -E ")
End Sub

Thanks
0
Comment
Question by:venkatesh ks
  • 8
  • 6
  • 2
16 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41801090
Hi,

Maybe
 
Sub Open_ModScript()
     Dim rc
        rc = Shell("ssms.exe -S CHNMCT123456D -d sample -U theUser -P thePW")
 End Sub

Open in new window

Regards
0
 

Author Comment

by:venkatesh ks
ID: 41801097
Hi,

That code is not working.  I replaced theuser as username, the PW as password. But ssms show dialog box which contain usage.
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41801099
and with
-noSplash
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:venkatesh ks
ID: 41801100
it shows

ssms.exe [-S servername[\instance_name]][-d database][-U user] [-p password] [-E] [-nosplash] [file_name[,file_name]*][-log [file_name]?][?]


and gives meaning from -s to.....[?]
0
 

Author Comment

by:venkatesh ks
ID: 41801106
HI Rgonzo1971,

I am new for this VB macros. If you give code , i will check it.
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41801108
Didn't quite understand
0
 
LVL 50

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
ID: 41801110
Sub Open_ModScript()
     Dim rc
        rc = Shell("ssms.exe -S CHNMCT123456D -d sample -U theUser -P thePW -nosplash" )
 End Sub

Open in new window

0
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 41801121
The syntax description shows a lower case -p for the password parameter.
Sub Open_ModScript()
     Dim rc
        rc = Shell("ssms.exe -S CHNMCT123456D -d sample -U theUser -p thePW -nosplash" )
 End Sub

Open in new window

0
 

Author Comment

by:venkatesh ks
ID: 41801216
in the above code i replaced my server name, database name, userid and password of the server. But it should not work. Sql server management studio shows a dialog box of usage. The usage box contain below code as,

"ssms.exe [-S servername[\instance_name]][-d database][-U user] [-p password] [-E] [-nosplash] [file_name[,file_name]*][-log [file_name]?][?]

[-S the name of the sql server instance to connect to]
...............
..............
[?] displays this usage information"

But the SSMS is not opening automatically by run this vb
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41801302
Sorry can't help further
0
 

Author Comment

by:venkatesh ks
ID: 41801309
Hello Rgonzo1971,

Do you know how to import xlcsv file into sql server by using VB?
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 41801311
Nope
0
 

Author Comment

by:venkatesh ks
ID: 41801315
Ok
0
 

Author Closing Comment

by:venkatesh ks
ID: 41801357
Thank You
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 41801558
Just tested with SSMS 2016 from the cmdline, and it works for me as expected. Even if the DB is wrong (does not exist), SSMS opens up with a connected query window.
0
 

Author Comment

by:venkatesh ks
ID: 41802632
Hi Qlemo,

How to upload xlcsv file in SSMS by using VB?
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question