Since a few days ago, the SQL server (Microsoft SQL Server 2005) backing our site has started occasionally timeouting. It is happening at seemingly random times approximately every hour or two. It usually takes about 10 minutes during which we see hundreds of timeouted requests. Under normal circumstances, most of our queries take less t...
Here is my query
Select Gender from Table
The result pane shows
1
1
1
2
2
But i want the results to be
Male
Male
Male
Female
Female
The names Male and Female wont be present in my database.... I want to just hardcode the names based on values from the select statement....
...
Can i apply SUM() within an ISNULL().... Consider my following sql server select statement
SELECT e.Emp_Id,e.Identity_No,e.Emp_Name,case WHEN e.SalaryBasis=1
THEN 'Weekly' ELSE 'Monthly' end as SalaryBasis,e.FixedSalary,
ISNULL(Adv.Daily_Wage,0) as Advance from Employee as e
inner join Designation as d on e.Desig_Id=d.Desig_Id...
I am using sql server 2005 and i want to measure some query performance using an analyzer tool.... Any good tool (free/Open Source) that you can refer.....
...
Hi all,
this is my relational model:
Request
------------------------------
RequestId
------------------------------
1
2
RequestState
------------------------------
RequestStateId | Name
------------------------------
10 | Received
20 | Processing
30 | Finsihed
Request...
I have a query returning 24 records for users with code A and 54 records for users with code B
and sometimes it will return Users with code C, D....etc there can be a total of 15 different Codes.
I want my query to only display the codes once, instead of returning retpeat users.
If i do something like
Select Count(user_code) from tb...
Using the SQL Server Import and Export wizard in Management Studio 2005 I've encountered a big problem. After selecting a set of tables whose data I want to copy (specifying Delete Rows in Existing Tab and Identity Insert in the mappings) I execute the wizard and my rows from one database are nicely copied into my identical but previousl...
Hey, I have been having a problem with my linked servers. I am using Microsoft Server 2003 and Microsoft SQL Server Management Studio 2005. I am linking to a MYSQL database through Microsoft studio since all of our other databases are controlled through MSMS.
The problem is that for any query that last for more than 5 sec I get this ...
I am trying to create a Pareto Chart in SQL Server Reporting Service 2005. I created a chart, but having difficulties in trying to get my cumulative(line) to display. I listed my values below.
=SUM(Fields!Total_SR.Value)/MAX(Fields!Total_SR.Value,
"SeriesGroup")*0.75
cumulative value:
=RunningValue(Fields!Total_SR,
Sum, "SeriesGroup...
I have 2 tables as follows (sample data shown):
TableName: A
ID Type
1 Bug
2 Requirement
3 Task
4 Specification
5 Bug
6 Specification
7 Production Issue
8 Production Issue
9 Bug
10 Task
Tablename: B
ID RelatedID
1 2
1 7
5 8
5 4
9 6
9 10
I want to fetch all the bugs that have atleast one related p...
Ok,
I've been doing a lot of reading on returning a random row set last year, and the solution we came up with was
ORDER BY newid()
This is fine for <5k rows. But when we are getting >10-20k rows we are getting SQL time outs, the Execution planned tells me that 76% of my query cost comes from this line. and removing this line increa...
Given a month and year, how do I know the dates for a day in that month.
e.g. Given month = Feb, year = 2010. I need to find the sunday dates in the month
The expected output is:
07/02/2010
14/02/2010
21/02/2010
28/02/2010
How to do so?
...
In my recent question, I asked for paging methods in SQL Server. Reading an article someone posted there, I came up with the following code. Everything seems correct to me but I receive the following error:
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or ...
Is there any way to retreive the result set of a sql query in a local variable; the query is to be run in a batch file. What I am trying to do is something like this:
set varname = osql -S%dstserver% -d%dstDB% -Q"SELECT name from table_name where Id = %siteId%" %osqluser% -b
varname is my local variable.
I am quite new in sql so any ...
We are using a custom Membership Provider in an ASP.NET MVC application. We have been experiencing intermittent 'System.InvalidOperationException - There is already an open DataReader associated with this Command which must be closed first.' problems with the class so I decided to enabled MARS.
This is the connection string in the web c...
How Can I Turn This DateTime value into something that Sql Server 2005 won't shout at me for.
2007-12-01T00:00:00+00:00
(All I care about is the date, NOT the time).
I get this error when I tried to pass this argument to my stored procedure as a DateTime variable (Both the C# object and the Sql Server object are DateTime variables and...
Given year, month, day and week number how to find the date?
e.g.
year = 2010
month = Feb
day = Wed
week number = 4, how can I find that the date is 24/02/2010
Thanks
...
Was scanning through a SQL2005 database and saw the following two indexes for a table:
**PK_CLUSTERED_INDEX**
USER_ID
COMPANY_ID
DEPARTMENT_ID
**NON-unique_NON-clustered_INDEX**
USER_ID
COMPANY_ID
My initial thought is, drop the last index since the PK_CLUSTERED_INDEX already contains those columns, correct order and sort. Do...
When I try to access a 2005 database in studio 2008 I receive the debugger does not support 2005 or earlier.
This is a new install, as far as I understand. Is there something that I need to turn off to disable this?
...
Scenario
I have a database made up of 4 columns and 6 million rows.
I want to be able to be able to use Excel to query this data in the same way in which I can query it using the Sql Server Management Studio.
I've had a google around and read a few articles but in all honesty I dont really know enough about the implementation to really...