SQL
There are 4 entries for the tag
SQL
In SQL, aggregate functions will return the group by values or the aggregate function results, but it is difficult (or at least harder than it should be) to return the primary key or ROWID. In contrast, most programming languages will return the instance (or a pointer/reference to the instance) when searching for items. Background A project manager allocated me several weeks ago on emergency basis to help out with another project that was having difficulties with a SQL Historian system. I ended up developing a nice set of SQL tables, functions, and stored procedures to transfer data from a remote...
building.aspx: SVG Part 2 sample BuildingSample02.zip: source (9KB) Note: Eventually all of the Building Map samples will be converted to Silverlight for comparison. In the last installment, I showed a simple example of a building map with static personnel information that worked with both Internet Explorer and FireFox. In this post I will add dynamic building information by generating JavaScript from SQL Server data. Step 1: Define a SQL table I defined a simple SQL table to store the information for the building occupants. The schema will become more sophisticated as the samples progress, so I...
I had a little fun with SQL Server last week trying to normalize a gas composition function that was returning a molar percentage of the gas. During testing we found several cases where the sum of the components did not add up to 100.0%. Of course due to floating point inaccuracies it is quite possible that rounding errors could also contribute to the issue. The values we were seeing were a couple of percentage points different and so we decided to normalize the data to ensure that it added up to 100.0%. At the same time, I rounded the components...
I found out an interesting thing about the SQL Server POWER function. I needed a historical average for a pH value which requires using the POWER function. In testing we noticed bizarre behavior:SELECT POWER(10.0, -7.0) -- Returns: 0.0
GO
When you read the documentation, there is an example where SELECT POWER(2.0, -100.0) returns 0.0 and the documentation claims it is due to floating point underflow. What the documentation neglects to tell you is the conversion of literal numbers -- it must be converting the literal number into a DECIMAL type instead of a FLOAT or...