Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
218 views

Cannot reseed the Table in sql server

I have below tables that I am trying to delete its record and reseeding it after deleting it and it is throwing an error that I cannot reseed the table, saying that the parameter 3 is incorrect. as ...
kinnangiant's user avatar
1 vote
1 answer
904 views

T-SQL MERGE statement is not inserting a new record - what is wrong with my code?

The code below is successfully updating an existing record but does not insert the new record where the details do not match and I don't understand why not as the code compiles and does not throw any ...
Aaron Reese's user avatar
2 votes
2 answers
50 views

More than Like Statement in a variable

why this work : SELECT * FROM Companies WHERE CompanyCode LIKE '%' AND BusinessUnitShortName LIKE 'CO%' while mean this not work : DECLARE @WHERECondition NVARCHAR(200) = '' SET @WHERECondition = ...
user2773107's user avatar
0 votes
1 answer
269 views

Using conditional to Update OR Delete

I have written a stored procedure that updates a table and then writes old records to a historical table, using OUTPUT deleted.* I am now looking to update the procedure and include an @option ...
Sam CD's user avatar
  • 2,107
2 votes
1 answer
2k views

Is it possible to replace an entire node with SQL DML?

I am very new to the SQL DML and I could use any help in discerning if this is possible. declare @xml XML, @id int, @new XML SET @id = 2 SET @xml = '<root><node ids=1><child /><...
SenseiHitokiri's user avatar
3 votes
3 answers
3k views

How can I avoid a timestamp insert error when copying data from one table to another?

I'm trying to cull the data in a list of tables (~30) based on a primary key. My approach has been to: 1.Create an intermediate table & load it with the desired data for each table 2.Truncate ...
Rolan's user avatar
  • 3,004
2 votes
1 answer
121 views

Modifying values of XML nodes with XML DML in SQL queries

I am trying to modify node values within an XML database field using XML DML within a SQL query. Say my table field has xml something like this:- <ContentTree> <ContentObject> <...
fbc's user avatar
  • 137
1 vote
1 answer
3k views

Change XML attribute values in SQL Server XML column

I have a SQL Server database table like the following:- Id (int) Info(xml) ------------------------ 1 <xml.... 2 <xml ... 3 <xml ... The XML in each record in the ...
fbc's user avatar
  • 137
1 vote
3 answers
104 views

Remove duplicates from the same table

I'm a SQL newbie and this is my first question posted. I need your expert advice please. Forgive me if the format is not correct or if this question has already been shot in the past but I couldn't ...
driveg81's user avatar
2 votes
1 answer
3k views

Setting conditionally required fields in SQL Server 2008

I need to make conditional requirements for fields. I'm not sure how this looks in SQL. I'm using Management Studio with SQL Server 2008. Essentially I would like a field to become required only when ...
JMT2080AD's user avatar
  • 1,079
0 votes
1 answer
502 views

XML DML for SQL Server 2008

I have an xml column ExportTemplate in a table that holds an xsl template that I need to modify. When I use the the query below, the server notifies that 1 row is affected but when I check the ...
itisinteresting's user avatar
1 vote
1 answer
408 views

SQL Server 2008 - complex Insert Trigger

I`m not a SQL programmer, but I have encountered an obstacle during my project and have to construct a trigger, which will fire after insert command. The problem is as follows: I have 3 tables: dbo....
Artur's user avatar
  • 343
0 votes
3 answers
954 views

SQL Server MERGE command - how to trap if nothing qualified

With this command, we can specify something like: WHEN MATCHED AND stm.StudentMarks > 250 THEN DELETE But how do we trap if a record didn't qualify? For example, say stm.StudentMarks = 100? I get ...
IamIC's user avatar
  • 18.3k