Join Gordon Luckett for an in-depth discussion in this video Adding SQL Server data to your map, part of Using SQL Server Spatial with AutoCAD Map 3D.
- If your SQL server has a table that contains a geometry column you can connect to it and render that data in AutoCAD Map 3D. You will need to have rights to access that table, but once you do, those features can appear in your map. Let's connect to SQL now. In display manager, click Data, Connect to Data. In the Data Connect window, choose Add SQL Server Spatial Connection. Type the name of the server where SQL Server is installed. Mine is littlesqlthatcould.
I'm going to log in. Now I could use my Windows authentication, but it's not set up in this case. Instead, I'm gonna use my SQL Server login, sa, system administrator. I'll type in my password and click Login. It doesn't look like anything's happened but if I click this arrow down, underneath the Data store I get a list of what databases are on that server. The one I want, in particular, is called TEST. So, I'll choose that. What I usually do, is I copy the name of the database or datastore and paste it as the connection name.
So, my connection name usually is the same as my datastore name. That way, I don't get confused on what sort of data connection I have. Because I know exactly, by the name, what database I'm connecting to. Let's click Connect. This will go into the database and list all the tables in that database. There's only one table in there called SPATIAL_TABLE and it has spatial data inside of it. Now, we don't have a coordinate system assigned to this. I could overwrite by clicking Edit Coordinate Systems and assign any sort of override.
But in this case, there's no particular coordinate system, so I'm just going to click Add to Map. Close the data connect window. Now you can see graphics in your map. In the display manager, you can click on Style and change the colors, if you wish, for the polygon, the polyline, or the point. I'm gonna change the style of the polyline, really quickly, to a different color, so it's more visible. And I'll close my style dialog box. And now you see my line is black.
If you hover over any of the features you will see some of the attribute data associated with them. If I save my DWG, right now, the next time I open it I'll have these graphics and my connection to SQL server still available. And once you've connected SQL Server and added those spatial objects to your drawing you can save the drawing and the next time you open it it will have the most recent version of the data from the database.
Before you begin this course, we recommend watching AutoCAD Map 3D Essential Training for a solid understanding of the program.