sql-server-2014

How to modify XML node that contains a specific child node value?

隐身守侯 提交于 2020-01-05 07:33:10
问题 I have a table with an XML column. How can I add another node inside a node that contains a child node with a specific value? For example I'd like to copy foo/bar/e/f node from barId 6699 to barId 66989. I only find examples where you select node based on an attribute value. I need to filter by child node value instead. <foo> <bar> <barId>66988</barId> <name>baz 3</name> </bar> <bar> <barId>66989</barId> <name>b </name> <e> <g> <h> <l>-</l> <m>k</m> </h> <h> <l>p v</l> <m>k</m> </h> </g> </e>

SQL Server - evaluation period has expired error

泪湿孤枕 提交于 2020-01-05 02:48:25
问题 Yesterday ended trial period of SQL Server 2014 installed on my PC. I decided to use express edition and uninstalled SQL Server 2014 and installed Express edition. But when I open SQL Server Management Studio, there is still an error: evaluation period has expired Afterwards I installed developer edition of SQL Server 2014 which is free now as I understood. The installation was successful but I still have the same error when I open SQL Server Management Studio. How can I use Express or

SQL Server CLR integration with 3rd party SDK: Error on missing assembly System.Drawing

北城余情 提交于 2020-01-04 07:35:47
问题 I am developing a solution that will interface with the SDK of a 3rd party application and ultimately create a dataset to migrate data into a destination database on our SQL Server 2014 instance. This interface is via a SQL Server CLR Stored procedure. the following references have been used in creating the CLR assembly on the C# side: using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using (3rd party SDK); using System

SQL Server CLR integration with 3rd party SDK: Error on missing assembly System.Drawing

旧街凉风 提交于 2020-01-04 07:35:13
问题 I am developing a solution that will interface with the SDK of a 3rd party application and ultimately create a dataset to migrate data into a destination database on our SQL Server 2014 instance. This interface is via a SQL Server CLR Stored procedure. the following references have been used in creating the CLR assembly on the C# side: using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using (3rd party SDK); using System

Remove all spaces and combine multiple lines to single line in SQL

对着背影说爱祢 提交于 2020-01-04 05:41:26
问题 What is the best way to remove all spaces from a string in SQL Server 2014? My string is: Maximize your productivity for building engaging, beautiful web mapping applications Trying to remove enter and tab spaces between string and 1 space between words. Result should be like: Maximize your productivity for building engaging, beautiful web mapping applications 回答1: If open to a UDF, the following will remove all control characters and repeating spaces. The removal of the repeating spaces was

Cannot find user defined datatype 'empnum' in SQL Server 2014

别说谁变了你拦得住时间么 提交于 2020-01-04 02:57:08
问题 When I run the following query in SQL Server 2014 to create a temporary table: CREATE TABLE #temp ( location char(16) null, location_desc varchar(25) null, Emp_Num EMPNUM null ) I receive the error: Cannot find the data type empnum. empnum is a user-defined data type. But the same user-defined data type is working fine in other stored procedures. Why am I receiving this error? 回答1: It looks like user defined types are defined at database level , not instance level , so they must be defined

Find time spent in a day along with work break taken

雨燕双飞 提交于 2020-01-04 01:56:16
问题 I am in a situation where I need to find-out total time spent in office for some internal application. I have sample data like this: Id EmployeeId ScanDateTime Status 7 87008 2018-08-02 16:03:00.227 1 8 87008 2018-08-02 16:06:17.277 2 9 87008 2018-08-02 16:10:37.107 3 10 87008 2018-08-02 16:20:17.277 2 11 87008 2018-08-02 16:30:37.107 3 12 87008 2018-08-02 20:06:00.000 4 Here Status have different meanings: 1- Start 2- Pause 3- Resume 4- End Means Employees start their work at ScanDateTime

Cannot see Integration Services Catalogs node in SQL Server Management Studio (SSMS)

僤鯓⒐⒋嵵緔 提交于 2020-01-03 04:26:10
问题 I wanted to create a SSIS catalog and the way to create a catalog is to right click on "Integration Services Catalogs" node and select "Create Catalog" option. However, I am not able to see the "Integration Services Catalogs" node in SQL Server Management Studio (SSMS) as shown in the following image. What is missing so that I can see this node in SSMS? Please help. FYI, I have SQL Server 2014 (Developer edition) and Integration Services 12.0 installed on my machine. 回答1: Got resolved for me!

How can I conditionally include large scripts in my ssdt post deployment script?

若如初见. 提交于 2020-01-02 07:40:23
问题 In our SSDT project we have a script that is huge and contains a lot of INSERT statements for importing data from an old system. Using sqlcmd variables, I'd like to be able to conditionally include the file into the post deployment script. We're currently using the :r syntax which includes the script inline: IF '$(ImportData)' = 'true' BEGIN :r .\Import\OldSystem.sql END This is a problem because the script is being included inline regardless of whether $(ImportData) is true or false and the

Update and Insert When Condition is Matched in TSQL-Merge

岁酱吖の 提交于 2020-01-02 07:32:15
问题 I have been trying to Write a Stored Procedure where i can perform UpSert using Merge with the Following Condition If Record is Present then change EndDate of Target to Yesterday's day i.e., Present Day - 1 If Record is not Present then Insert New Record Here is the Table tblEmployee i used in SP CREATE TABLE tblEmployee ( [EmployeeID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](10) NOT NULL, [StartDate] [date] NOT NULL, [EndDate] [date] NOT NULL ) Here is my SP which Takes UDTT as Input