Is there any better approach to get notification about changes in SQL SERVER database?

This may be a silly question ,but please help me sort this. I have a SQL database with tables and whenever there is row added/deleted/updated ..(any operation) in the table a notification should be available through a desktop c# app running in system tray. There is already notification mail sending mechanism in SQL SERVER but […]

Identity Role check works locally, but not on deployed instances – Entity Framework with Owin

I’m presented with this error: Server Error in ‘/’ Application. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 […]

Replace XML string using SQL Server Replace or CLR Regex?

I have the following XML string: <row> <id> <old></old> <new>2151</new> </id> <name> <old></old> <new>test</new> </name> <amount> <old></old> <new>62</new> </amount> </row> I need to parse and replace the string so that the end result will have the format: columnname|oldvalue|newvalue^ Therefore the above example would look like this: id||2151^name||test^amount||62^ The XML string will always contain one row […]

Oracle to SQL Server Migration issue – On delete cascade

Folks, Iam working on Oracle to MS Sql Server migraiton. One of the issue I came across is that “ON DELETE CASCADE” works fine in Oracle, but not in Sql Server. Is there any alternative to the syntax/command or is it something we need to manually remove/fix it. Could not get a valid link/reference on […]

Transact SQL CONTAINS not returning match for identical strings with a wildcard

I’m encountering an issue on SQL Server 2008r2 where use of the CONTAINS function is not returning a match for completely identical strings. I’m pretty sure I’m misunderstanding something about CONTAINS. I’ve set up the following test case to replicate it. CREATE TABLE texttest ( loldex INT PRIMARY KEY IDENTITY, testcolumn NVARCHAR(255) ) GO INSERT […]

SSIS job failure through SQL Agent

My SSIS package is running fine in Visual Studio locally. The package contains (at the end) a process task to execute an .exe file that generates a xml file. Note: Earlier, The package was scheduled in SQL Server 2005 and it was running fine. Now, I have migrated this package to SQL server 2012 and […]

Sql Server – Group rows

The problem is that I have a table in which I have multiple rows like this: Name Container DateOrder HourOrder Test1 | Container1 | 04-21-2015 | 11:00 Test1 | Container2 | 04-22-2015 | 16:00 Test2 | Container2 | 04-15-2015 | 01:00 Test3 | Container3 | 04-15-2015 | 15:00 I need to do a report by […]

How to Split a String XML Column into no of rows based on the nodes present inside the XML Field

I have a SQL table in the below format with only one XML column: [XML] <?xml version=”1.0″ encoding=”UTF-8″?> <htmlString> <MENUACTION v=”Contact”/> <MENUKEY/> <PROGRAM v=”SOWMENU03″/> <HTMLFILE v=”CGI/TEMP”/> </htmlString> I want to split this table row as follows based on the nodes inside [Value_XML] [Control_ID] [Data_Value]** <MENUACTION v=”Contact”/> MENUACTION Contact <MENUKEY/> MENUKEY <PROGRAM v=”SOWMENU03″/> Program SOWMENU03 <HTMLFILE […]

Calculate years in service

I made the following sql query to get a list of all employees who are 10 years in service. I’m wondering if this is the best and most efficient way to do this. For example: how can I calculate a list of all employees who are 12.5 in service? DECLARE @YEAR_CURRENT VARCHAR(4) SET @YEAR_CURRENT = […]

Weekending date in view

I have a view in which I need to show the weekending date for each row. I have used the following query: SELECT TOP (100) PERCENT [Delivery Date], [Delivery Method], [Order Total], YEAR([Delivery Date]) AS Year, DATEADD(d, 7 – DATEPART(dw, [Delivery Date]), [Delivery Date]) AS WeekEnd FROM dbo.salesdata ORDER BY [Delivery Date] DESC Works well […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.