Solved

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

Posted on 2016-09-16
16
35 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 48

Expert Comment

by:Rgonzo1971
Comment Utility
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
Comment Utility
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 48

Expert Comment

by:Rgonzo1971
Comment Utility
and with
-noSplash
0
 

Author Comment

by:venkatesh ks
Comment Utility
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
Comment Utility
HI Rgonzo1971,

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

Expert Comment

by:Rgonzo1971
Comment Utility
Didn't quite understand
0
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 250 total points
Comment Utility
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 68

Accepted Solution

by:
Qlemo earned 250 total points
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:venkatesh ks
Comment Utility
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 48

Expert Comment

by:Rgonzo1971
Comment Utility
Sorry can't help further
0
 

Author Comment

by:venkatesh ks
Comment Utility
Hello Rgonzo1971,

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

Expert Comment

by:Rgonzo1971
Comment Utility
Nope
0
 

Author Comment

by:venkatesh ks
Comment Utility
Ok
0
 

Author Closing Comment

by:venkatesh ks
Comment Utility
Thank You
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
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
Comment Utility
Hi Qlemo,

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now