All Questions
207
questions
7
votes
0
answers
155
views
Modeling tabular structure in MSSQL to store data like Excel sheet applying Column inheritance
I've created this database structure to store tabular information (it's a simplification of my real structure but enough to show the point). In it I have Sheets and ...
4
votes
0
answers
55
views
Insert a page definition in the right order
I have a table SlideList that defines all available slides that can be put into a PowerPoint presentation. I have a table ...
3
votes
1
answer
79
views
Simple script to insert data
This is a simple script which inserts data into a couple of tables. I'm very new to SQL so any feeback, of any kind, would be much appreciated!
...
0
votes
2
answers
4k
views
Merge table stored procedure
I wrote a stored procedure that will do a merge of two tables:
...
3
votes
2
answers
98
views
SQL Server - Iterate, aggregate, and insert
I'm trying to find an efficient way to aggregate data for reporting. Let's say I need to aggregate the following data in 5-second intervals:
...
4
votes
1
answer
39
views
Parse numbers from text based on relative position to certain substrings
The input is a product code. I want to pull out the "percentage" portion of that code. For example, if the code contains the substring BIO, I want all the numbers that follow it until I hit another ...
2
votes
1
answer
109
views
SQL Query to check if 100+ (or Dynamic) columns in table is null
Let assume a table has more than 100 of columns & I want to display all the rows when all of its columns (Col1, Col2, ..., ColN) are nulls except for the column(s) I mentioned (PK).
This is just ...
0
votes
1
answer
83
views
Query to show each sites stock transfer history between all other sites
The below query is used to return a dataset for a SSRS report. It works fine and is quick enough but I am looking for any improvements that could be made.
The client has asked to see all transfers ...
1
vote
2
answers
61
views
Displaying a single record based on DocID
I have a table with ~900,000 records. I need to display a single record based on DocID using this query. The record is the latest record that got modified by another program.
This piece of query run ~...
9
votes
1
answer
132
views
The seasoned Zombie sniper: a query to find unanswered questions with specific tags
The query (on SEDE)
This query builds upon the previous and includes the suggestions by rofl as well as the now mentioned activity index.
...
11
votes
1
answer
112
views
The sniper: a Zombie searcher for specific tags
Sometimes, it's not enough to know what the easy prey is. You also need to know whether you will be able to hunt it down. What good is an almost turned haskell zombie if you cannot read the functional ...
15
votes
1
answer
1k
views
A wounded Zombie finder, or: how to find the almost dead undead?
The Zombies are on their way to eat our statistics. Fortunately, we have a way to get rid of them: our votes. However, we need to find them first. The /unanswered section is too large and contains ...
2
votes
3
answers
81
views
search for text across multiple tables
I've got the following query.
...
0
votes
1
answer
1k
views
T-SQL query outer apply with nested subqueries
I have the following 3 tables, and I don't have the option to modify them.
[Logs] table with [log_type], ...
2
votes
2
answers
144
views
T-SQL simplify repeated query unions for each day of the week
I've created the T-SQL code below to get the next nearest datetime value during the next 7 days.
The ScheduleDetail table schema is:
...