Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

How to Connect to SQL Server from Visual Studio in VM for D365FO

Bharani Preetham Peraka Profile Picture Bharani Preetham Pe... 3,634 Moderator
As a developer, in a day to day activity and with this much technology, if something is too slow, we hate it for obvious reasons. On a similar note, in regards with F&O, once login to VM, we will open Visual Studio, SSMS, Note pad...., where we find SSMS can take some time to open.

What if we are able to run queries from Visual Studio?

Visual Studio has a bigger or we can say a hidden capability to run queries.

The Approach
To connect to SSMS or to run SQL query directly from Visual Studio,

>>> First we need to navigate to Tools in the Visual Studio and then SQL Server and then click on New Query



>>> The below screen gets popped up where we need to copy the characters from username just before the slash and paste that in server name. Database name would be selected from dropdown which is a default. And then, to mark the Trust Server certificate to true. On click on connect, we are ready to run the queries.


>>> Below is the Query editor where all the types of queries can run just like SSMS. Make sure the DB selected is AXDB like below. Because by default "master" will be selected.




If the query results seem to have very less size, to increase the size, navigate to Options and then find this Fonts and Colors and in the Show settings for, select the SQL Results - Grid from the dropdown and increase the size as needed. 



Conclusion
This approach can save our valuable time where we can't wait for SSMS to load and use this time to get more productive ideas.

This can also be used to directly connect Sandbox with dev within Visual Studio.



PS: The Server Name or the User Name from those images are just for blog sake and doesn't exist in reality:)

Stay Tuned to many new things!

Comments