I don't even want to think about how many man hours have been spent writing the same queries to join over the exact same tables at my company.
When I first started at my job I identified this as an inefficiency and started writing views in a separate schema for the sole purpose of developer convenience.
My boss didn't like this very muc...
If I want to do an admin function like delete a user on the asp.net membership stuff that ships with the asp.net mvc sample.
I tried looking through the tables and realized that there was multiple tables that had rows added. I assume there must be a simpler way.
...
I heard that there is a keyboard short cut to bring up the code of a SQL Server 2005 (Management Studio) stored procedure. This key combination would do the same function as sp_helptext.
This may only be an Urban Legend.
Thanks
...
I have a column, say PROD_NUM that contains a 'number' that is left padded with zeros. For example 001004569. They are all nine characters long.
I do not use a numeric type because the normal operation on numbers do not make sense on these "numbers" (For example PROD_NUM * 2 does not make any sense.) And sense they are all the same leng...
Is it possible to maintain the order of the WHERE clause when doing a SELECT for specific records?
For instance, given the following SELECT statement:
SELECT [RecSeq] FROM [MyData] WHERE
[RecSeq]=3 OR [RecSeq]=2 OR [RecSeq]=1 OR [RecSeq]=21 OR [RecSeq]=20 OR
[RecSeq]=19 OR [RecSeq]=110 OR [RecSeq]=109 OR [RecSeq]=108 OR
[RecSeq]=53 O...
I want to update a table with consecutive numbering starting with 1. The update has a where clause so only results that meet the clause will be renumbered. Can I accomplish this efficiently without using a temp table?
...
Below is a SQL query I wrote to find the total number of rows by each Product ID (proc_id):
SELECT proc_id, count(*)
FROM proc
WHERE grouping_primary = 'SLB'
AND eff_date = '01-JUL-09'
GROUP BY proc_id
ORDER BY proc_id;
Below is the result of the SQL query above:
proc_id count(*)
01 626
02 624
03 626
04 624
05 622
06 624
07 ...
We recently upgraded a database server from SQL 2005 to SQL 2008 64 bit. CPU utilization is oftentimes running at 100% on all four processors now (this never happended on the SQL 2005 server). When I run sp_lock I see a number of processes waiting on a resource called [ENCRYPTION_SCAN]. I am not using any SQL 2008 encryption features. Do...
Yes, this is rather subjective, but I am doing research on that matter and am curious to see if others have come to the same conclusions that I have. So, I ask, if you could only monitor 10 SQL Server 2005 counters, what would they be?
...
I have a table with dated records. I want a query that will show the number of records for each date.
Not hard, just a GROUP BY, right? Sure.
But I want to also show days where there were NO records. In this case, I would need to left join against a one-column table of consecutive dates, since a GROUP BY isn't going to show a date t...
I've got a probably very simple issue to which I can't find a satisfactory (subjectively seen) answer in the Zend Framework manual or elsewhere...
There are so many ways how I can hand over my php variables to my sql queries that I lost the overview and probably I lack some understanding about quoting in general.
Prepared Statements
$...
How do I update different columns and rows across a table? I want to do something similiar to replace a string in SQL server
I want to do this but the value exists in multiple columns of the same type. The values are foreign keys varchars to an employee table. Each column represents a task, so the same employee may be assigned to severa...
I have a table which has data from a graph.
for example
index value
0 3
1 5
2 7
3 6
4 8
5 9
6 12
7 11
8 10
9 14
10 13
I need to a query that returns the results where the value is at a local maximum, i.e. the value at a particular index is greater than the value at index+1 and in...
Question: Is it possible to stop SSMS from monitoring the service status of registered servers?
Details:
SSMS 2008 monitors the service status of every registered server. From what I have seen it seems to reach out to every registered server every minute or so to check it's status, in my case that is over 100 servers. This process has...
I'm trying to model football statistics in PostGreSQL and I have something that works but it doesn't quite feel right. Here's the problem:
I have teams, games and stats. For every game there are two teams. Each team has a single offensive statistic line that might include rushing, passing, etc. However, that offensive stat is implic...
I am used to writing data manipulation logic in SQL and now that I am learning R I find myself sometimes just wanting to do something that would be simple in SQL but I have to learn a bunch of stuff with R to do the same manipulation on an R data frame. Is there a simple work around?
I'm considering writing to a database, doing my mani...
I have logic consisting of selecting a large number of records from one system, performing multiple transformations (based on business rules) and inserting them into another system.
It seems like a high performance (and memory) hit to instantiate each of these records as an object, perform transformations on them and then insert all of ...
I have following table structure and data in MySQL
CatID CatName ParentCatID
-------------------------------
1 Shirts NULL
2 Short Sleev 1
3 Long Sleev 1
4 Collarless 2
5 Collar 2
6 Collarless 3
7 Collar 3
8 Square Cut 4
9 Round Cut ...
The following method in a static class gives me a time out exception because the connection pool is maxed out.
While in debug mode I looked in sql Management studio and saw there were 150 sleeping processes.
I expected the connections to be closed automatically...I also tried putting as a static member and still got the same Error.
A...
Hi,
I want to Copy a Row in SQL which has child records in 2 other tables. i want to duplicate them all if the master record duplicates.
for example if i say i want to copy master record with id 15 in to a new record. i want all its child records to be duplicated with the new master record id as well. can do it through TSQL using loops...