Skip to main content

All Questions

Tagged with
1 vote
1 answer
116 views

Update Trigger (Comparing Descriptive string), as well as checking for valid updates

I have an audit table EpisodesHistory. One of the fields that gets copied is eDescription. I expect ...
Regular Jo's user avatar
1 vote
1 answer
976 views

Ontario Health Card mod 10 validation

An example of the business rules are here. Does this code implement those rules correctly? Note that you will have to derive the rules from the example. ...
Dan Bracuk's user avatar
3 votes
1 answer
99 views

Creating SQL Indexes on Large Tables

I currently have a table with about 29 million records. The table currently has no indexes. However, I would like to build a clustered composite index built on three columns. When I attempt to add ...
indigochild's user avatar
8 votes
3 answers
651 views

SQL trigger to log when employee records are updated

I am learning TSQL (SQL in general for that matter), and I wrote this trigger that inserts logs about updated employees into the tblEmployeeAudit table. When I was ...
czyngis's user avatar
  • 183
1 vote
2 answers
67 views

Stored procedure for processed orders in SQL Server

I am struggling with creating a Stored Procedure in SQL Server for getting sales statistics. I have managed to get the information I need out, but the query is a mess and I have probably messed up the ...
thrustmaster's user avatar
2 votes
1 answer
68 views

Trigger Updating another table - Baseball Database

This is my first time writing T-SQL so I'd like to get some criticism on how I wrote this trigger. I'm building a Pitch-Tracking App that will use a relational database to track Pitches, At-Bats, ...
jDave1984's user avatar
  • 208
-1 votes
3 answers
83 views

Insert to table from a temporary table [closed]

I created a procedure involving dynamically collecting from various projects (databases) some records into a temporary table and from that temporary table I am inserting into a table. With a ...
BinaryTie's user avatar
  • 157
1 vote
1 answer
439 views

Alternative to XML PATH

This inserts into 3 tables really quickly. My SELECT at the bottom appears to take an age, I assumed it would be fairly quick but is not. Is the XML path the right ...
Simon's user avatar
  • 149
3 votes
1 answer
127 views

Speed up SQL query

I have a query that I need help with speeding up. Right now it takes long enough that it often times out. I do know that the part of the query that times out is part of an ...
Mike's user avatar
  • 185
1 vote
1 answer
74 views

Posts that probably need editing

I wrote this Data Explorer query (reproduced below) some time ago that helped identify posts containing potential spelling/punctuation errors and earned me a Copy Editor badge on Anime.SE. ...
Gao's user avatar
  • 955
2 votes
2 answers
105 views

SQL Server Stored Procedure quality

I'm beginner in programming and I have recently written quite an advanced stored procedure. Based on parameters with which I call it, it returns data and groups it, but that is not the most important ...
gregs's user avatar
  • 31
1 vote
1 answer
52 views

Remove table variable from query

I am running this query, and to get the calculation that I need, I use a table value parameter to house some of the data. Scanning roughly 50K rows to create the table value parameter then performing ...
BellHopByDayAmetuerCoderByNigh's user avatar
0 votes
1 answer
48 views

Concatenating results in a comma separated list

I am trying to list all of the employees linked to a certain 'Interaction' I want the employees listed on one line with comma's separating them, I have the following query which works but is very slow....
David Waldron's user avatar
3 votes
2 answers
64 views

FInd the correct Casing description from process tracking - Scalar Function

It works as intended, I just wonder if there is any stylistic things I could improve. It already runs well fast enough, although I'd be open to speed increases. This SQL Server 2008 Scalar Function ...
Magisch's user avatar
  • 330
3 votes
1 answer
88 views

Calculating employee points

I have one table on which I want to perform some calculations. The table stores employee points that are awarded for performing various tasks. The relevant structure is as follows (table has about ...
Stan Shaw's user avatar
  • 139

15 30 50 per page
1
3 4
5
6 7
14