I have the situation where i have two databases with same structure. The first have some data in its data tables. I need to create a script that will transfer the data from the first database to the second. I have created this script. DECLARE @table_name nvarchar(MAX), @query nvarchar(MAX) DECLARE @table_cursor CURSOR SET @table_cursor = […]
I have a inline select statement to calculate the product of the set of values. Since SQL Server 2005 doesn’t have a built in Product aggregate function, I am using LOG/EXP to get it. My select statement is: (select exp(sum(log(value))) from table where value > 0) Unfortunately I keep getting the following error: Msg 3623, […]
I make a query that return to me the count of Stored Procedure that created everyday as follow SELECT convert(varchar, crdate, 103) as Date,Count(*) as Counter FROM sysobjects WHERE (xtype = ‘p’) AND (name NOT LIKE ‘dt%’) Group by convert(varchar, crdate, 103) and its already work but dates appear in string format that i can’t […]
I’m working on some reports in SSRS 2005. I have a bit of experience of SSRS, but I can’t figure out for the life of me how to do this. The report pulls in a data set from a stored procedure. Then I basically want to generate a Pie Chart for each row in the […]
I have two Microsoft SQL 2005 databases setup in a fail over scenario. The application connection strings have the “Failover Partner” specified in the connection string. When the currently live database fails over to the slave database, there is a small time period that a user can obtain a SqlClient.SqlException with the message “An existing […]
Hey all, is there any SQL Server 2005 guru that can tell me a type of trick to get the values of what is being queried? Ex: UPDATE l SET Inactive = 1 FROM tbl1 e JOIN tbl2 l ON l.CID = e.CID JOIN tbl3 p ON p.PID = e.PID JOIN tbl4 c ON c.PID […]
I have date in format mm/dd/yy.For eg:4/1/2009 means April 1 2009.I want to get format as April 1,2009 in sql.Can anybody help?
I’d like to know what application connected to DB and executing SPs. (I want to limit SP execution to only my App – all other – eg MS SSMS would be ignored) So is there a way to find out connected client name? If not maybe you have other suggestion how to ensure only dedicated […]
I want to know whether one SP is referenced anywhere. Currently I am checking using SP_DEPENDS. Is there any other way to check this…?
SELECT COUNT(td.timeSheetID) FROM TimeSheet t INNER JOIN TimeSheetDetail td ON t.timeSheetID = td.timeSheetID WHERE (CONVERT(DateTime, t.setDate, 23) BETWEEN ‘2012-08-10’ AND ‘2012-08-12′) AND t.employeeID = 300 The above code returns the value i’m looking for. However, when i do the following, i get nothing: SELECT COUNT(td.timeSheetID) FROM TimeSheet t INNER JOIN TimeSheetDetail td ON t.timeSheetID = […]