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

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
venkatesh ksAsked:
Who is Participating?
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.

Rgonzo1971Commented:
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
venkatesh ksAuthor Commented:
Hi,

That code is not working.  I replaced theuser as username, the PW as password. But ssms show dialog box which contain usage.
0
Rgonzo1971Commented:
and with
-noSplash
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

venkatesh ksAuthor Commented:
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
venkatesh ksAuthor Commented:
HI Rgonzo1971,

I am new for this VB macros. If you give code , i will check it.
0
Rgonzo1971Commented:
Didn't quite understand
0
Rgonzo1971Commented:
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
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
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

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
venkatesh ksAuthor Commented:
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
Rgonzo1971Commented:
Sorry can't help further
0
venkatesh ksAuthor Commented:
Hello Rgonzo1971,

Do you know how to import xlcsv file into sql server by using VB?
0
Rgonzo1971Commented:
Nope
0
venkatesh ksAuthor Commented:
Ok
0
venkatesh ksAuthor Commented:
Thank You
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
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
venkatesh ksAuthor Commented:
Hi Qlemo,

How to upload xlcsv file in SSMS by using VB?
0
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
Microsoft Excel

From novice to tech pro — start learning today.