I am a SQL newbie. I have been working with Visual Studio 2015 preview. It allows me to create a project that uses a SQL database. I have a table:
CREATE TABLE [dbo].[ElementTable] (
[AtomNum] TINYINT DEFAULT ((1)) NOT NULL,
[AtomSymb] NCHAR (3) NOT NULL,
[AtomName] NCHAR (15) NOT NULL,
[AtomRadius] DECIMAL (18, 5) NULL,
[AtomWeight] DECIMAL (18, 5) NULL,
[AtomBoilPt] DECIMAL (18, 5) NULL,
[AtomMeltPt] DECIMAL (18, 5) NULL,
[AtomDensity] DECIMAL (18, 5) NULL,
[AtomState] NCHAR (10) NULL,
[AtomOxyState1] SMALLINT NULL,
[AtomIonRadius1] DECIMAL (18, 5) NULL,
[AtomOxyState2] SMALLINT NULL,
[AtomIonRadius2] DECIMAL (18, 5) NULL,
[AtomOxyState3] SMALLINT NULL,
[AtomIonRadius3] DECIMAL (18, 5) NULL,
[AtomOxyState4] SMALLINT NULL,
[AtomIonRadius4] DECIMAL (18, 5) NULL,
[AtomOxyState5] SMALLINT NULL,
[AtomIonRadius5] DECIMAL (18, 5) NULL,
[AtomOxyState6] SMALLINT NULL,
[AtomIonRadius6] DECIMAL (18, 5) NULL,
PRIMARY KEY CLUSTERED ([AtomNum] ASC)
);
And I have a view:
CREATE VIEW [dbo].[AtomicDataView]
AS SELECT * FROM [ElementTable]
If I am looking at the SQL Server Object Viewer Tab, and right-click on the dbo.AtomicDataView that is in my Atomic database, I get list of things I can do like a 'Data Comparison' between different views on the same table, like all of the columns or only certain columns, and then between different databases, one original one replicated, and the can update the target. I also can 'Rename', 'Delete', 'Script As', 'View Code' (which just shows a couple of lines seen above), 'View Permissions', and 'View Data' which allowed to enter the data in the table. While under my 'Projects' listing just below the servers, I see a duplicate directory structure, yet when I right-click on the dbo.AtomicDataView list item, I don't get the 'View Data' option.
When I compile my project, I get 2 files, one is a DLL, the other is a DACPAC file. I am used to C++ headers and Source files for pragmatic use of variables and functions. I am not sure what files I can add that will be able to work with the data in the static table of 110 rows, meaning data won't change in the columns, nor will any more rows be added, and essentially will be a read-only table. I presume that my Atomic.mdf is where it is all stored.
I want to write various 'get's, maybe one for each data column, but lets say I want to:
SELECT AtomRadius FROM dbo.ElementTable WHERE AtomNum = x;
And I want to programmatically supply 'x', and use the resulting data, so
where would I put that kind of statement? Could I put more than one statement in a SQLQuery? How would I use or access an MFC class from inside this DLL, and what file types do I use, and how do I include them, and then use them from an outside EXE that wants to import data from the DLL?
Then If I manage to SELECT it, how do I get it into a variable to compute a surface area or volume?