﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Need guidance on how to Insert a new record between existing records / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 13:52:14 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Need guidance on how to Insert a new record between existing records</title><link>http://www.sqlservercentral.com/Forums/Topic1428781-392-1.aspx</link><description>Hmm, seems to me that in this case the query is the same either way, with exactly the same WHERE clause structure.The only difference is that the WHERE comparison value, the value compared to the column value, is also an int instead of a date.</description><pubDate>Fri, 08 Mar 2013 17:19:59 GMT</pubDate><dc:creator>ScottPletcher</dc:creator></item><item><title>RE: Need guidance on how to Insert a new record between existing records</title><link>http://www.sqlservercentral.com/Forums/Topic1428781-392-1.aspx</link><description>This is nothing more than updating the table where date is greater than the date being passed in. The reason you are having a problem is because you have dates stored as an integer. You first have to painstakingly split that int into a usable datetime and this becomes trivial.[code]Update YourTableset CardNumber = NewCardNumberwhere MemberNbr = PassedInMemberNbrand EffectiveDate &amp;gt;= PassedInDate[/code]If there is ANY chance you can change this table to use the correct datatype for dates it will go a long way to making your life easier.</description><pubDate>Fri, 08 Mar 2013 15:21:56 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: Need guidance on how to Insert a new record between existing records</title><link>http://www.sqlservercentral.com/Forums/Topic1428781-392-1.aspx</link><description>Would help if we know what the income record looked like for one.  Also, if you could provide the DDL (CREATE TABLE) statement for the table, the sample data as a series of INSERT INTO statements, and what the expected results should look like when the code completes that would be helpful.</description><pubDate>Fri, 08 Mar 2013 15:14:58 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>Need guidance on how to Insert a new record between existing records</title><link>http://www.sqlservercentral.com/Forums/Topic1428781-392-1.aspx</link><description>Here is a the table structure:MemberNbr Varchar(11)MemberCardNumber Varchar(10)EffectiveDate IntTermDate IntSample data is:Membernbr           MemberCardNumber            EffectiveDate             TermDate12345678909        A020129091                      20120101                   2012043012345678909        A020129091                      20120501                   2012063012345678909        A020129091                      20120701                   2012083112345678909        A020129091                      20120901                   0I receive an incoming file which indicates that this member updated his CardNumber toB020129091 on 20120516 and I need to update the table to reflect this change in all his recordsgoing forward from 20120516, overwriting, if necessary records which exist in the table and whichhave effective dates &amp;gt; than 20120516 while also maintaining the TermDates.Does anyone have some guidance on the SQL to do this?</description><pubDate>Fri, 08 Mar 2013 15:09:14 GMT</pubDate><dc:creator>Nilssond</dc:creator></item></channel></rss>