Avatar of venkatesh ks
venkatesh ks
 asked on

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
Microsoft ExcelMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
venkatesh ks

8/22/2022 - Mon
Rgonzo1971

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
venkatesh ks

ASKER
Hi,

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

and with
-noSplash
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
venkatesh ks

ASKER
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.....[?]
venkatesh ks

ASKER
HI Rgonzo1971,

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

Didn't quite understand
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Qlemo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
venkatesh ks

ASKER
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
Rgonzo1971

Sorry can't help further
venkatesh ks

ASKER
Hello Rgonzo1971,

Do you know how to import xlcsv file into sql server by using VB?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Rgonzo1971

Nope
venkatesh ks

ASKER
Ok
venkatesh ks

ASKER
Thank You
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Qlemo

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.
venkatesh ks

ASKER
Hi Qlemo,

How to upload xlcsv file in SSMS by using VB?