I’ve got an orders table which contains order details delimited by spaces – the order details may contain multiple items (Yes I know this breaks database convention but it’s one of our third party databases). I’ve been able to extract it but the solution isn’t very elegant. Not sure if you guys have any better […]
I’d like to check the status of the agent after I start it using this statement EXEC sp_startpublication_snapshot @publication As I want to do a next step that needs the job to be already started.
I have got two SQLServer2008 user-defined functions: fn_Top and fn_Nested. The first one, fn_Top, is structured in this way: CREATE FUNCTION [dbo].[fn_Top] RETURNS @Results table ( MyField1 nvarchar(2000), MyField2 nvarchar(2000) ) AS BEGIN INSERT INTO @Results ( MyField1, MyField2 ) SELECT item, (SELECT MyString FROM dbo.fn_Nested(x.MyCounter)) FROM OtherTable x RETURN END I would like to […]
i want to add the days(for example 3 days) to the given date. Before adding days we can check the holidays which are already configured in one table. Here is my sample code. But i am unable to achieve it. declare @HolidaysList NVARCHAR(250) = ‘2014-06-29,2014-07-02,2014-07-18,2014-07-30,2014-10-26’ DECLARE @RDATE DATE = ‘2014-06-28’ declare @addDays int = 3 […]
Is there any script to find out the type of hard disk being used on SQL Server?
We’ve a WCF service which is called by clients that run in parallel. I’d like to support a transaction between methodA, methodB, methodC in the service method being called. However, some of the calls fail with the following error message: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at […]
A community consultation, it brings me to my query this data: ID_KAR ALMACEN FECHA CODIGO_PROD MONTO ———————————————————————————- 16275 AVIOS E INSUMOS 2011-01-01 00:00:00.000 0 ANS0001UNI 18100.0000 39823 AVIOS E INSUMOS 2011-06-06 00:00:00.000 2 ANS0001UNI 18100.0000 8718 AVIOS E INSUMOS 2011-01-01 00:00:00.000 0 AV-AC-766 9015.0000 23243 AVIOS E INSUMOS 2011-01-06 00:00:00.000 2 AV-AC-766 477.0000 23247 AVIOS […]
I had to see version of my sql server management studio, I went to Help –> About, it showed me following screen: link to image: About Screen of my SQL Server Management Studio It clearly shows that SQL Server is R2 with version 10.50.1600.1. But when I run query Select @@version, It returns me this: […]
Machine ID Hostname IP Address 1 Test 1 10.216.x.x 2 Test 2 10.218.x.x 3 Test 3 172.21.x.x 5 Test 4 192.25.x.x I need to add a column where 10.216.x.x segment will be Chennai and 192.25.X.X will be Delhi etc Machine ID Hostname IP Address Location 1 Test 1 10.216.x.x Chennai 2 Test 2 10.218.x.x Mumbai […]
This question already has an answer here: Get top 'n' records by report_id 3 answers