All Questions
Tagged with dml sql-server-2008
13 questions
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 ...
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 ...
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 = ...
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 ...
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 /><...
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 ...
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>
<...
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 ...
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 ...
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 ...
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 ...
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....
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 ...