Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Updating with a Self-Join - SQL Server

RSS
Modified on Thu, Aug 12, 2010, 12:22 PM by Administrator Categorized as SQL Server
The following SQL will copy the SnippetId from the folder "table" onto the ParentId of the item table.

update
    item
set
    item.ParentId  = folder.SnippetId        
from
    dbo.Snippet item
    inner join dbo.Snippet folder
        on item.SnippetGroupId = folder.SnippetIndex
        and item.FolderFlag = 0
        and folder.FolderFlag = 1

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.