Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (1)

2
votes
0answers
28 views

EF6-Lambda Expressions deep big-tree query

I am looking to improve the following query. We are using EF6 (CodeFirst) and C# Lambda Expressions, and Repository/Unit of Work patterns. Also, we needed to restrict the query in a way that we ...
1
vote
0answers
14 views

EF query for calculating monthly trends

My application has a fairly important query that is used in a lot of places. Unfortunately it takes about 14 seconds to run, so I'd like to find a way of possibly improving it. The application ...
9
votes
2answers
178 views

Find records with duplicate serial number

I was tasked today with cleaning up data from a SSRS report put together by a DB programmer. The original report was to find duplicate serial number sales within a user-defined period of time. I was ...
1
vote
1answer
120 views

Stored Procedure calculating employee earnings

I have following stored procedure in a C# win forms application which calculates employee earnings based on attendance as follows. Note that a shift is 12 hours and employees mark attendance for in ...
-5
votes
1answer
194 views

Can this stored procedure be cleaned up or made even more efficient?

I have this stored procedure that I'd like improved. I have changed the DB name and the procedure name. I am working on SQL Server 2000. ...
7
votes
1answer
96 views

Fluent Nhibernate, is the mapping correct?

I'm very new to NHibernate and DB. I have three tables which are connected with many to many relationship. Here are the tables creation Script: ...
2
votes
0answers
40 views

Insert an SQL Server Table rows into a Bigquery table in one bloc

I want to insert all rows of an SQL server Table into a Bigquery Table having the same schema. The streaming insert row by row is very slow: to insert 1000 rows ...
3
votes
2answers
42 views

Calculating percentage of 3 test forms

Please help me to simplify the script below. It has a lot of variables and a lot of values are getting assigned to them. Can I make it simpler? It has to calculate the percentage of 3 test forms: ...
2
votes
2answers
72 views

Simple Data Access Layer

I have DatabaseContext class. ...
6
votes
2answers
87 views

Inefficient query actually more efficient?

I have two queries; one runs significantly faster than the other, but the faster one is the one that I would have bet money on to be less efficient. These are both being executed through a front end ...
5
votes
1answer
459 views

Can I populate this table faster?

I have the following SQL query which takes ~3 seconds to run, maybe ~4. This populates a consultants table with their expected payments for the month. Unfortunately, the page only loads when this ...
1
vote
2answers
57 views

Text file searching using SQL

I have the need to search a directory containing 1000+ files on remote servers where I only have access to SQL Server Management Studio and Explorer. I have written the below SQL statement which does ...
1
vote
0answers
52 views

Insert all SQL Server table rows in a Google BigQuery Table

I am coding in Coldfusion. I want to know the best way (best performance and reaction time) to insert all rows of an SQL table into a Google Bigquery Table. Actually I am looping over a query result ...
6
votes
1answer
98 views

Count and group rows for six months prior

I've written the following query for SQL server: ...
10
votes
1answer
145 views

Password Manager UI: Populating DataGridView is Painfully Slow

I'm designing a small account/password manager using C# and SQL Server CE. LINQ to SQL is my ORM of choice. Here's the data model representing how the SQL Server CE database is set up: And here's ...
11
votes
3answers
150 views

SEDE Top Sponsors

I wanted to see the site's top sponsors - users that have paid bounties on questions that they didn't own. I started off with a bounty-related existing query, selected the details into a subquery, ...
4
votes
1answer
40 views

SEDE query to find users with exactly one post in a particular tag

I'm doing some research for a meta post on Gardening.SE (where I'm a pro tempore moderator). I'm using the Stack Exchange Data Explorer (SEDE) to find information about first time users who post ...
1
vote
2answers
53 views

Store Procedure Timing out sometimes?

Can someone please review my this Store Procedure which is timing out? ...
7
votes
2answers
245 views

VB.Net Database Access Class

I've recently been asked to make some emergency changes to a legacy application written in VB.Net. I come from a C# background so am not overly familiar with this language, though there are enough ...
7
votes
2answers
216 views

Creating ADODB Parameters on the fly

I have put together a small wrapper class to simplify creating parameterized ADODB queries with VB6/VBA. At this point I'm keeping things simple, so it's only supporting input parameters and from what ...
2
votes
1answer
44 views

The use of database “sets” rather than “functions”

I've currently got a MSSQL stored procedure that uses multiple SQL functions to achieve a number of returns. Now I've been told about using sets rather than functions as it creates " bad code smell of ...
0
votes
1answer
59 views

How can I modify this query for performance?

This is the stored procedure I'm using to list some places in my website. How can I optimize it to perform well? Which functions in query is taking much time for its execution? ...
3
votes
4answers
2k views

Inner join with first result

In SQL Server, there is two tables: Houses, and their images. I need a list with 20 houses with the first of their images (only one). I tried: ...
10
votes
2answers
195 views

Another way to run reports on a SpiceWorks SQLite database using a linked server in SSMS?

I created a linked server in SSMS so that I could run reports on a SpiceWorks SQLite database. there are a few quirks in the whole system. These simple queries are becoming some of the most ...
5
votes
1answer
241 views

Fastest image upload into SQL database

Hello I am trying to upload an image (screenshot from desktop) to SQL database as fast as possible. I would like to optimize my current procedure in terms of speed: ...
6
votes
1answer
47 views

Aggregating Conditional Sums

I have recently forked/rewritten a SEDE query (here) that aims at figuring out where a site stands in terms of avid users and distribution of reputation scores, compared to a specific target (number ...
6
votes
1answer
2k views

Splitting an address into fields in SQL

I have the following code to split an address string in T-SQL. Excepting the unit number, which is already in its own field, it would affect too much of the application to split the address into ...
3
votes
1answer
122 views

Querying a warehouse database

Consider the query given below: ...
7
votes
3answers
175 views

Return Data and Update Row without Multiple Lookups?

I have a stored procedure that looks up an article based on the article's title. But I also need to increment a column in the same table that counts the number of times the article has been viewed. ...
5
votes
2answers
165 views

Do I have any SQL leaks?

This is a Windows service that will run on about 600 machines. It is used to track the job server that a user is connected to (pushed through some kind of load balancer, not my area). I store this ...
3
votes
1answer
223 views

Populate Drop Down List from SQL Database

I am populating a drop down list from my SQL database. List should be able to be displayed with active only, inactive only or both at the same time. OfficeRepository.cs: ...
13
votes
1answer
159 views

Calculating Lost Reputation

A discussion arose not long ago on the 2nd Monitor about how much reputation has been lost due to the reputation caps. There are a number of queries on the SEDE which try to address this: A Users ...
3
votes
2answers
184 views

SQL PreparedStatement; Am I doing it right?

I am building a web app with a single (not pooled) full time (jdbc) connection between static classes and the database. This is expected to be a low traffic site and the static methods are ...
0
votes
1answer
24 views

What datatype should I use to complete this task [closed]

I want to be able to allow a user to not put the leading ZERO on any decimal number in a textbox in C# ( like .1 ). I then want to convert this to a decimal or float or any datatype that will ...
3
votes
1answer
43 views

Best way to get two columns from a table

Basically I have taken over a project and found a table that has the following video and video title fields in it (why they didn't create a separate linked table is beyond me): ...
5
votes
3answers
335 views
4
votes
1answer
375 views

Code First Entity Framework

Is the following good design for doing entity framework code first? What am I missing for a production system? I haven't included all my code, just a snapshot... My application, doesn't update the ...
3
votes
2answers
208 views

Using SQL with encryption

This is my first project I am doing in VB.NET, and also my first real programming project. There is sensitive data, so I am utilizing Microsoft's Encryption/Decryption class (...
2
votes
2answers
107 views

Returns Office Details from Database

I am building an Administration web site for the Office details in my database. Right now, I am just trying to display the office details. ...
4
votes
3answers
83 views
0
votes
1answer
30 views
3
votes
0answers
343 views

Compare Oracle Table with Sql Server Table and Update/Insert

Below is the current code wish used to update/insert records from Oracle view to Sql server table using Dapper. there is not field to check last record updated date in the oracle view so I have added ...
8
votes
2answers
222 views

Should a year and month be stored as separate fields or as a date?

We have a table with calculated data that groups sales by product, year and month, to provide fast querying for statistics. My colleague argues that the year and month should be two separate fields, ...
2
votes
0answers
96 views

Am I getting the right information about installed SQL Server Instances?

I'm building an installer package for our software using Inno Setup. As a part of this, I'm also building a few different DLL's in Delphi XE2 to accommodate for some of the common tasks required by ...
8
votes
2answers
57 views

SE Data Explorer Query: Average score for questions and answers, by tag

Being curious to see which tags on this site get the most attention, I developed a Stack Exchange Data Explorer query: ...
7
votes
1answer
102 views

Can you replace a REPLACE statement, or 9?

I would really like something to replace all of these REPLACE Statements. ...
1
vote
0answers
168 views

node.js Syslog server recording to ms-sql database

This 43 line program is designed to listen for Syslog messages on port 514 and record the messages to an MS SQL Server database table. I would appreciate feedback from experienced node.js developers. ...
4
votes
2answers
382 views

Selecting the number of working days minus weekend days and UK bank holidays

I am fairly new to coding TSQL script and am looking for some second view on my script. The goal here is to to pull in some data and amongst that data to show a field with a counting the number of ...
3
votes
4answers
341 views

Shifting records in SQL Database while sorting with algorithm

I have a table in a SQL Server database, which holds information of some images, and the relevant gallery of them. The columns are like: ImageId, ...