I need to write a T-SQL query where i need to get number of bugs logged in our database per month. and i am using the below query for that
as [No. of Bugs],
View Complete Post
View Complete Post
I was wondering is it possible to use a query on one instance that (perhaps using linked servers) quieries another server to ask what instances are installed on it.
Is this possible in SQL Server or do I need to use an external method?
Is there any function to calculate number of business days in a month for a particular date. my input would be just a single date
I am using following code for Robert's Posted Code (Url:http://forums.asp.net/t/1142378.aspx) But this is for only calculate weekends saturday and sunday can any one tell me how I get Number of days between given two dates Monday to Friday.
private const int MONDAY = 1;
private const int TUESDAY = 2;
private const int WEDNESDAY = 3;
private const int THURSDAY = 4;
private const int FRIDAY = 5;
private const int SATURDAY = 6;
private const int SUNDAY = 7;
/// Observe that the method calculates by including the start day, but excludes the end day
/// <param name="startDate"></param>
/// <param name="endDate"></param>
private void GetWeekendDaysBetween(DateTime startDate, DateTime endDate,out int saturdays,out int sundays)
saturdays = -1;
sundays = -1;
if (endDate < startDate)
TimeSpan timeBetween = endDate.Subtract(startDate);
int weekendsBetween = timeBetween.Days / 7;
I have no clue why my query is acting weird
If i try to run it for 1/1/2010 9/30/2010 the query takes around 1min 26 sec and return around a million rows
and If i run for 8/1/2010 to 8/31/2010 it takes forever to it...
basically i am getting data from 5 tables and putting it in a temp table and then updating that temp table 2-3 times with some information and then displaying it.
I am stumped as to why it works fast for a longer date range and runs the snail for a small period of time..
I am in the verge of pulling my hair and going crazy..
any help will be appreciated.
I would like to have an incremental number for each row of data. I would get as output a column where the first row would have the value 1 and the last row would have the total of rows. Any ideas about how could I do this?
I'm using SSAS 2000, so I can't use the function CurrentOrdinal .
Thanks in advance for any help.
I have a query that takes a multi-word search string and parses it to spit out a LIKE (with AND or OR) condition that I then insert into my dynamic query.
Example of my parsing:
SELECT '(c.CakeName LIKE ''%' + REPLACE(REPLACE(REPLACE(REPLACE(
'cheese chocolate cake'))),
' ', ' þ')
, 'þ ',
''), ' þ'
'%'' OR CakeName LIKE ''%') + '%'')'
Say for example that a user searches for the string "cheese chocolate cake". My parsing would result in the following string:
(c.CakeName LIKE '%CHEESE%'
OR CakeName LIKE '%CHOCOLATE%'
OR CakeName LIKE '%CAKE%')
What I wan to do is sort the results based on the number of characters that were actually matched. So, if c.CakeName contained the following:
The results would be sorted thusly:
I'm currently develop a monitoring and evaluation database with many indicators
For example: I have two input indicator : car , truck
I'd like to create an output indicator have field: formular. The result of vehicle = car + truck = 5
Vehicle Car + truck
I don't now how to parse this string, detect parameter: car, truck to get the answer
I search on Google and find some Math parse like: muParser, bcnet but it just for a string
Please help me solve this
I need a query that provides the current number of running instances of a client application.
The application is developed on VS2008 (.NET3.5, VB.NET) and accesses an Oracle 10g database via System.Data.OracleClient 184.108.40.206. Here the view SYS.V_$SESSION yields all I need to get the current number of running applications (which is the same as the number
of users logged in on each application instance).
I extended the application in order to access the database alternatively hosted on Sql Server 2008 R2 using System.Data.SqlClient 220.127.116.11. The view sys.dm_exec_sessions seems to be an equivalent to Oracles SYS.V_$SESSION but actually it is not!:
Are there any solid examples/tutorials/demos of how to dynamically generate custom report item instances in a report based on the amount of rows in a data set?
Additionally I would like to insert these custom report items in a particular order based on a field in the data set.
Any help/pointers/articles would be appreciated!
I have a table that looks like this:
[Date], [Person], [Value]
22/03/2008, Person A, 3.1
22/03/2008, Person B, 4.2
03/04/2008, Person B, 5.1
04/04/2008, Person B, 3.0
06/04/2008, Person C, 3.0
I need a query to return a table that shows the totals of each person's value for each month of the proceding 12 months from Date X. So if Date X is 30/04/2008 then my result table would look like this:
Thanks in advance.