Update query for XMLTYPE column

Hello everyone,
I have inserted xml data into XMLTYPE column of my table,xml data is something like this
<Data type="FYI">                         
<ID xmlns="http://orcl.com">T-1-1</ID>
<Category>FRAME</Category>
<ProductID>1</ProductID>
<Name xmlns="http://orcl.com">Frame </Name>
<Type>BASIC</Type>
<Code>INSTALL</Code>
<NodeID>1</NodeID>
</Data>
Now i need to update the values inside the <Data> element,like
ID == T-2-2
Category == IFRAME
ProductID == 1.1
Name == IFRAME
We are using oracle 10g R2.
Please help me out how to update. It would be very thankfull for your valuble suggestions
Thanks in advance

<Services>
<DataService type="FRLY">
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<CategoryCode>FRAME</CategoryCode>
<ProductOfferingID>1</ProductOfferingID>
<Name xmlns="http://www.openapplications.org/oagis/9">Frame Relay</Name>
<SubType>FRLY - BASIC</SubType>
<ActionCode>INSTALL</ActionCode>
<NodeID>1</NodeID>
<Contract>
<ID xmlns="http://www.openapplications.org/oagis/9" schemeName="Networx Universal">00000</ID>
<Category name="Contract Type">U</Category>
</Contract>
<Contract>
<Type xmlns="http://www.openapplications.org/oagis/9">Routine</Type>
</Contract>
<CustomerParty>
<Location/>
</CustomerParty>
<ProvisioningStatus type="BillingSetup">
<Description xmlns="http://www.openapplications.org/oagis/9">C</Description>
</ProvisioningStatus>
<MileStone>
<ID xmlns="http://www.openapplications.org/oagis/9">CWD</ID>
<Date>2007-01-29</Date>
</MileStone>
<ActivityStatus>
<Code xmlns="http://www.openapplications.org/oagis/9" name="DueDate"/>
<EffectiveDateTime xmlns="http://www.openapplications.org/oagis/9">2007-01-29T00:00:00Z</EffectiveDateTime>
</ActivityStatus>
<AssociatedIDs>
<ID xmlns="http://www.openapplications.org/oagis/9">1</ID>
</AssociatedIDs>
<AssociatedIDs>
<TemporaryID schemeName="OPKEY">34908</TemporaryID>
</AssociatedIDs>
<Location>
<ID xmlns="http://www.openapplications.org/oagis/9">T-510092</ID>
</Location>
<OrderID>RequestID</OrderID>
<Accessory>
<ActionCode>ADD</ActionCode>
<Description xmlns="http://www.openapplications.org/oagis/9">IBM ESERVER-XSERIES306</Description>
<CategoryCode>5</CategoryCode>
<InstallVendorParty>
<Name xmlns="http://www.openapplications.org/oagis/9">MCI</Name>
</InstallVendorParty>
</Accessory>
<Circuit>
<ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
<AssociatedIDs/>
</Circuit>
</DataService>
</Services>
This was my xml which i have inserted into DB for the column XMLTYPE.Now i need to update few values in this whole file like values of
ID under<DataService>
Name under <DataService>
ID under <Contract>
Description under <ProvisioningStatus>
i was using the UPDATEXML query to update those it's saying i row updated but when i extract it says null.
Please help me out to solve this problem.
Thanks in advance.

Similar Messages

  • Performance of update query for single column vs multiple column

    Hi All,
    I could not find any answer for this, does it ever matter in terms of performance updating single column versus multiple column in a single update query.
    For eg. table consisting of 15 columns, what would be the difference in performance when one column is update in the single query against another update query where 15 columns are updated.
    Please do keep in mind my table columns in actually could be around 150+.
    Thanks for any information provided.

    If updated columns aren´t on where clause , then the only impact of 15 columns will be a increase on redo generation, and a possible chainning row.
    So since the redo is one of the things that have a large impact, the answer is yes.
    The performance will be slower.
    Regards
    Helio Dias.
    http://heliodias.com
    OCE SQL, OCP 9i

  • Problem query of XMLType column in XSQL servlet

    Hi all,
    I'm having trouble debugging the following error from a query on an XMLType column in an XSQL page query:
    <page xmlns:xsql="urn:oracle-xsql" connection="jdbc/DBConnection1DS">
    <xsql:query max-rows="1" null-indicator="no">
    SELECT extractValue(x.DOCBOOKS_DOC, '/book/part/title', 'xmlns="http://docbook.org/ns/docbook"') "BOOK TITLE"
    FROM DOCBOOKS_STORE x
    </xsql:query>
    </page>
    which returns the following error message:
    <page>
    <ERROR>
    oracle.xml.sql.OracleXMLSQLException: Character ' ' is not allowed in an XML tag name.
    </ERROR>
    </page>
    The SQL query works fine in the SQL Worksheet and SQL Plus, only when I stick it in an XSQL query. I've tested the XSQL Page environment with a query on Number Datatype column and no issues there either.
    Any suggestions, much appreciated. Thanks.
    George

    The XML SQL Utility creates XML tags named after your column aliases.
    You have aliased the column to a name containing a space: "BOOK TITLE"
    This error is telling you that the implied XML element whose name matches this column alias, which would be <BOOK TITLE> is not a legal name for an XML element since it has a space in it.
    You'll need to pick a column alias with no space in the name. For example, "BOOK_TITLE" and then in your XSLT stylesheet (or whatever downstream formatting tool you may be using) remove the underscore from the name and replace it with a space.

  • Need help with query for converting columns to rows

    Hello,
    I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
    I have a table which is having multiple columns as follows:
    Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
    Col1 Col2
    X      0
    Y     0
    Z      2
    A     0
    B     0
    C     1
    D     3
    E     0
    F     0
    G     0
    H     0
    I      0Please anybody help me in writing the query for this..

    Is this what you are expecting:
    SQL> WITH T AS
      2  (
      3  SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
      4  )
      5  SELECT  'X' col1, X col2 FROM T
      6  UNION ALL
      7  SELECT  'Y' col1, Y col2 FROM T
      8  UNION ALL
      9  SELECT  'Z' col1, Z col2 FROM T
    10  UNION ALL
    11  SELECT  'A' col1, A col2 FROM T
    12  UNION ALL
    13  SELECT  'B' col1, B col2 FROM T
    14  UNION ALL
    15  SELECT  'C' col1, C col2 FROM T
    16  UNION ALL
    17  SELECT  'D' col1, D col2 FROM T
    18  UNION ALL
    19  SELECT  'E' col1, E col2 FROM T
    20  UNION ALL
    21  SELECT  'F' col1, F col2 FROM T
    22  UNION ALL
    23  SELECT  'G' col1, G col2 FROM T
    24  UNION ALL
    25  SELECT  'H' col1, H col2 FROM T
    26  UNION ALL
    27  SELECT  'I' col1, I col2 FROM T
    28  /
    C       COL2                                                                   
    X          0                                                                   
    Y          0                                                                   
    Z          2                                                                   
    A          0                                                                   
    B          0                                                                   
    C          1                                                                   
    D          3                                                                   
    E          0                                                                   
    F          0                                                                   
    G          0                                                                   
    H          0                                                                   
    C       COL2                                                                   
    I          0                                                                   
    12 rows selected.

  • Query for Identifying column changes

    Hi Guys,
    Need help in getting a query for my scenario.
    I have 2 table Table A and Table B. Both have same columns and data type.
    Table A:
    Id  PersonId    Name      Code      Date
    1    1000           John         M         2014-07-28
    2    1001           Mary         B         2014-07-28
    3    1002           Robin        R         2014-07-28
    4    1003           Maxie        N         2014-07-28
    Table B:
    Id  PersonId    Name      Code      Date
    1    1000           John                     2014-07-28
    2    1001           Hary         S         2014-07-28
    3    1002           Justin       Q         2012-07-28
    4    1003           Maxie       P         2013-07-28
    My situation is:
    I need to compare both the tables and need to identify the rows that has a change in all columns, if all other columns are not changed and Code is changed to blank, i need to ignore that row.
    The expected outcome is:
    Id  PersonId    Name      Code      Date
    2    1001           Hary         S         2014-07-28
    3    1002           Justin       Q         2012-07-28
    4    1003           Maxie       P         2013-07-28
    Thanks Guys...

    I found the solution in a easy way i guess...
    select * from 
    SELECT ID, PERSONID,NAME,
    case when code is null then
        select a.code from tablea A where A.ID = B.ID
    else
     a.code
    end as Code,
    DATE FROM TABLE B
    MINUS
    SELECT ID,PERSONID,NAME,CODE,DATE FROM TABLE A
    What do you guys think...would it work for my scenario....
    i am testing few scenarios looks like working.......

  • Update query for 2 lakhs records

    I have 2 tables with 3 common columns (Col1, col2,Primary). One common column name is primary (oracle key word). No indexes are used on these tables. I need to write an update query as shown below. 
    Emp table
    Col1       col2        primay
    100         101         y
    103         104         n
    201         105         y
    100         101         y
    Dept table
    Col1       col2        primay
    100         101         null
    103         104         null
    000         656         null
    Update query Result
    Col1       col2        primary
    100         101         y
    103         104         n
    Please help me.
    Thanks

    Update dept d
    set d.primay = (select distinct e.primay from emp e where e.col1 = d.col1 and e.col2 = d.col2);
    In emp table there are 100 and 101 with two entries but with same primay value. so to handle such scenarios I have taken distinct iniside select statement.
    if you have a case like where in emp table col1 and col2 are same and having different primay table, then obviously you should tell which value should go and update the dept table and based on what logic.

  • Getting the system generated column name for xmltype column

    Hello,
    how i can get the internal column name (p.a. SYS_NC00001$) for a xmltype column? I cannot find a correct dictionary view .
    I need that for moving a xmltype lob partition to another tablespace.
    Thanks,
    MaikR

    Does the following help:
    http://www.idevelopment.info/data/Oracle/DBA_tips/LOBs/LOBS_2.shtml
    http://www.liberidu.com/blog/?p=264

  • NOTIFICATION QUERY FOR UDF COLUMN

    Dear experts,
    I want notification query for delivery should not be add without fill up the information in  machine number column (UDF Column- U_MCnumber)
    Please do needful.
    Thanks & Regards,
    Akshata

    Dear all,
    I have got query ...........
    If @object_type = '15'and @transaction_type= ('A')
    BEGIN
    If Exists (Select T0.DocEntry from ODLN T0 Inner Join DLN1 T1
    On T0.DocEntry=T1.DocEntry INNER JOIN OITM T3 ON T3.ItemCode = T1.ItemCode
    Where (T1.U_MCnumber Is Null and T3.ITMsgrpcod='119')
    And T0.DocEntry = @list_of_cols_val_tab_del  )
    BEGIN
    Select @error = -1,
    @error_message = 'Please fill up machine number!!!'
    End
    End
    Thanks & Regards,
    Akshata

  • Update query for lumia 925

    Hi All,
    I'm using Lumia 925, recently got an update option for my phone and I updated it.
    Its now showing lumia black.
    But even after the update I'm not able to get the option for call+sms setting (for call block feature)
    Can someone help me with this??
    Thanks
    Aman Mehra

    Hi mehraaman,
    Kindly Update all System Apps on your phone. Follow the instruction here: WP8 System Apps.

  • Update query for a table

    Hi
    Can any body send valid update query like this:
    <sql:update var="XX">
    Update emp set name='yy', phone='1234' where id='abc'
    </sql:update>
    Thanks in Advance
    SP

    Hi
    Can any body send valid update query like this:
    <sql:update var="XX">
    Update emp set name='yy', phone='1234' where id='abc'
    </sql:update>
    Thanks in Advance
    SP

  • Single Update query for multiple tables

    Hiii ....
    I want to update Table A and Table B in a single update query can it be possible.
    it is something like i have previously done with Mysql.
    e.g ..
    UPDATE A, B set a.A=1, b.B=X where (id.A= id.B) and id=101.
    Is it possible or how can i do it, help me out.

    sorry, i am posting the mysql example agin, it is something like this
    e.g ..
    UPDATE A, B set A.a=1, B.b=X where (A.id= B.id) and A.id=101

  • Query about XMLTYPE column structured storage in Oracle Xml db

    Dear All,
    DB Version: Oracle 11g (11.2.0.3.0)
    I have an table having one column as XMLTYPE with Structured storage.
    CREATE TABLE Orders
        Order_id NUMBER NOT NULL,
        Order_etc VARCHAR2(100),
        Order_desc XMLType NOT NULL
        XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA  "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
    I have then registered the XSD with XML Db schema which is required for Structured storage.
    Before this table creation I had created a table (db_objects) of XMLTYPE and was able to use the below query to check for what all objects the XMLTYPE table got broken into when I registered its XSD.
        SELECT column_name,     
               data_type
        FROM   user_tab_cols
        WHERE  table_name = 'DB_OBJECTS';
    And used below query to look for data stored in Object-Relational structure for my table (DB_OBJECTS) created with XMLTYPE definition.
      SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER')       AS owner
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID')   AS object_id
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED')     AS created
        FROM   db_objects do
         ,      TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq 
        WHERE  ROWNUM <= 10;
    Now could someone let me know, how to find how the column (Order_desc) of XMLTYPE was broken down into further objects just like I did for the Table with XMLTYPE (as shown above)?
    Many Thanks.

    First given that you are on 11.2, ExtractValue is deprecated and the documentation lists three options to use instead.  Here is one option (untested)
    SELECT owner, object_name, object_type, object_id, created
      FROM db_objects do,
           XMLTable('/ROWSET/THISROW'
                    PASSING do.object_value
                    COLUMNS
                    -- Set data types accordingly
                    owner        VARCHAR2(20) PATH 'owner',
                    object_name  VARCHAR2(20) PATH 'object_name',
                    object_type  VARCHAR2(20) PATH 'object_type',
                    object_id    VARCHAR2(20) PATH 'object_id',
                    created      VARCHAR2(20) PATH 'created');
    Second, why does column order matter?  You are storing in an object relational method.  As long as the XML is valid per the schema, the Oracle will be able to store the data and later retrieve it as well.  How that data is stored is mostly Oracle internals and should not be touched as it can be changed from version to version.  You can use schema annotation to control how Oracle maps and stores the XML, but nothing in there specifies column order that I am aware of.
    It seems additional details are missing as to what you need the information for so that would help others answer your question.

  • Update query for managing an Oracle spatial database

    Hi,
    i'm trying to manage a spatial network i have created in Oracle 11g. One of the tables i have created named "DE_OSM_RT_LINK$", contains data for links which exist between nodes. The link table contains a column named "Cost". All the values of this column are equal to "0". I need to UPDATE these values with the length of each link. I have made a query which finds the length (using data from the geometry column) but i can't make a query that finds the length and simultaneously updates the "cost" column. The query i have tried to make in order to update the "cost" column with the length is:
    UPDATE DE_OSM_RT_LINK$
    SET COST = (SELECT SDO_GEOM.SDO_LENGTH (d.geometry, m.diminfo)
    FROM DE_OSM_RT_LINK$ d, user_sdo_geom_metadata m
    WHERE m.table_name = 'DE_OSM_RT_LINK$' AND m.column_name = 'GEOMETRY');
    It doesn't run. I can't find what else is needed in this query in order to update the "cost" column. Could you please help me because i don't have much experience?
    Thank you

    Try connecting as SCOTT/TIGER, then do this:
    select * from user_sdo_geom_metadata;
    if the table does not exist, then spatial hasn't been installed
    if it does exist, then spatial (or locator) has been installed.
    If the table didn't exist, rerun the installer, choose a custom
    installation, and check the Spatial box, then install.
    If the table did exist, or after you install spatial, you'll want to
    use the user's guide, or take the spatial course to get started.

  • Update query for jstl

    Hi
    I have one jsp page which shows values for id, name, Phone in text boxes.
    Here id is unique and not editable.
    Based on id a user can edit name and Phone # and when he submits it should be updated in the db where id = xxx.
    <c:set var="i"   value="${param.Id}"  />
    <c:set var="e"   value="${param.Name}"  />
    <c:set var="m"   value="${param.phone}"  />
    <form method=post action="myPage.jsp" >
    <sql:transaction dataSource="${example}">
      <sql:update var="Power" >
       UPDATE emp
       SET NAME='<sql:param value="${param.Name}"/>',
       PhoneNum='<sql:param value="${param.phonenum}"/>',
       WHERE ID = '<c:out   value="${f}"/>'
      </sql:update>
    </sql:transaction>
    <center>
    <h4><p>ID:                 
              <input type="text" name="txName" size="15" value="<c:out   value="${f}"/>" >
    </h4>
    <h4><p>Name:
          <input type="text" name="txtexName" size="15" value="<c:out   value="${e}"/>" >
    </h4>
    <h4><p>Phone:         
          <input type="text" name="txManum" size="15" value="<c:out   value="${m}"/>" >
    </h4>
    <input type="submit" value="SUBMIT"/>  
    <input type="reset" value="CANCEL"/>
    <center>
    </form>I am getting Invalid Column type error when I run this page.
    Any suggestion please
    SP

    The JSTL sql taglib uses java prepared statements.
    You use question marks to indicate where you want the parameters to be substituted, exactly like JDBC (in fact it IS JDBC)
      <sql:update var="Power" >
       UPDATE emp
         SET NAME=?, 
         PhoneNum=?,
         WHERE ID = ?
        <sql:param value="${param.Name}"/>
        <sql:param value="${param.phonenum}"/>
        <sql:param value="${f}"/>'
      </sql:update>Also if you have
    <input type="text" name="txName" size="15" value="<c:out value="${f}"/>" >
    when you save this page, it will be available in JSTL as
    ${param.txName}
    I don't know where your Name and phonenum parameters are coming from.
    I am getting Invalid Column type error when I run this page.What are the types of columns for name, phonenum and id?
    Numbers? Strings?

  • Update Query For Hierarchy Table

    Hi All
    I have a Hierarchy table that has news categories. I want use a query than when user deactivate a category, all child category has been deactivated. For example
    1- Politics
    1-1- National Politics
    1-2- International Politics
    1-2-1- Asia
    1-2-2- Africa
    2- Economic
    If Politics has been deactivated, all child must be deactivate. (1-1, 1-2, 1-2-1, 1-2-2)
    Please help me
    With Best Regards

    This is table structure script:
    SET NUMERIC_ROUNDABORT OFF
    GO
    SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
    GO
    IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors
    GO
    CREATE TABLE #tmpErrors (Error int)
    GO
    SET XACT_ABORT ON
    GO
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    BEGIN TRANSACTION
    GO
    PRINT N'Creating schemata'
    GO
    PRINT N'Creating [dbo].[Modules]'
    GO
    CREATE TABLE [dbo].[Modules]
    [Module_ID] [int] NOT NULL,
    [ModuleName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [ModuleTitle] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Status] [int] NULL
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating primary key [PK_Modules] on [dbo].[Modules]'
    GO
    ALTER TABLE [dbo].[Modules] ADD CONSTRAINT [PK_Modules] PRIMARY KEY CLUSTERED ([Module_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating [dbo].[Categories]'
    GO
    CREATE TABLE [dbo].[Categories]
    [Category_ID] [int] NOT NULL IDENTITY(1, 1),
    [Module_ID] [int] NOT NULL,
    [ParentID] [int] NULL,
    [Name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Title] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Priority] [int] NULL,
    [ThumbnailImage] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [Status] [int] NULL
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Creating primary key [PK_Categories] on [dbo].[Categories]'
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED ([Category_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    PRINT N'Adding foreign keys to [dbo].[Categories]'
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [FK_Categories_Modules] FOREIGN KEY ([Module_ID]) REFERENCES [dbo].[Modules] ([Module_ID])
    GO
    IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
    GO
    IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION
    GO
    IF @@TRANCOUNT>0 BEGIN
    PRINT 'The database update succeeded'
    COMMIT TRANSACTION
    END
    ELSE PRINT 'The database update failed'
    GO
    DROP TABLE #tmpErrors
    GO
    This is table data
    SET NUMERIC_ROUNDABORT OFF
    GO
    SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS, NOCOUNT ON
    GO
    SET DATEFORMAT YMD
    GO
    SET XACT_ABORT ON
    GO
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    GO
    BEGIN TRANSACTION
    -- Pointer used for text / image updates. This might not be needed, but is declared here just in case
    DECLARE @pv binary(16)
    PRINT(N'Drop constraints from [dbo].[Categories]')
    GO
    ALTER TABLE [dbo].[Categories] DROP CONSTRAINT [FK_Categories_Modules]
    PRINT(N'Add 14 rows to [dbo].[Categories]')
    GO
    SET IDENTITY_INSERT [dbo].[Categories] ON
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (1, 1, NULL, 'News', N'اخبار', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (2, 2, NULL, 'Article', N'مقالات', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (3, 3, NULL, 'Galleries', N'گالری', 3, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (4, 1, 1, 'Politics', N'سیاسی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (5, 1, 1, 'Economic', N'اقتصادی', 2, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (6, 1, 4, 'NationalPilitics', N'سیاست داخلی', 1, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (7, 1, 4, 'InternationalPolitics', N'سیاست خارجی', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (8, 1, 7, 'Asia', N'آسیا', 1, '', 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (9, 1, 7, 'Europe', N'اروپا', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (10, 1, 7, 'Africa', N'آفریقا', 3, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (11, 2, 2, 'Scientic', N'علمی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (12, 2, 2, 'Art', N'هنری', 2, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (13, 3, 3, 'Culture', N'فرهنگی', 1, NULL, 1)
    INSERT INTO [dbo].[Categories] ([Category_ID], [Module_ID], [ParentID], [Name], [Title], [Priority], [ThumbnailImage], [Status]) VALUES (14, 3, 3, 'Religion', N'مذهبی', 2, NULL, 1)
    SET IDENTITY_INSERT [dbo].[Categories] OFF
    PRINT(N'Add constraints to [dbo].[Categories]')
    GO
    ALTER TABLE [dbo].[Categories] ADD CONSTRAINT [FK_Categories_Modules] FOREIGN KEY ([Module_ID]) REFERENCES [dbo].[Modules] ([Module_ID])
    COMMIT TRANSACTION
    GO
    Thanks for your help

Maybe you are looking for

  • Adding vendor name to Position part in report Payment List - s_p99_41000099

    HI, How can I add Vendor Name to detail level of the Payment List report (transaction s_p99_41000099). Change Layout window allows to add Vendor Name to the header level and Vendor Number to the detail level. Users want to export report into Excel an

  • How to restore library in itunes....

    Hi, my entire itunes library was accidentally deleted, but I do have the entire thing on ipod. My question is, how do I get my library back on itunes? My itunes account is set to automatically sync, so if I plug the ipod into itunes, everything on th

  • An error occurred at the server : Your request was cancelled due to an internal error on the Page Server. The object you are try

    hi i am getting this error. An error occurred at the server : Your request was cancelled due to an internal error on the Page Server. The object you are trying to view does not have the required property 'SI_FILES'. Please contact your system adminis

  • Vendor Rebate

    Dear Friends need your help, we are implementing vendor rebate. Subsequent settlement: time of LIS update :- this control data is having three options like Purchase order / goods receipt / invoice verificatoin. but as per current business requirment

  • Factorising code!!

    Please can anyone help me?! I'm trying to factorise the code below, so that when I run BinTest5a, bu clicking the "next" button, BinTest5b is loaded. HOWEVER, at present, this link between the classes is working, but I want to factorise our the commo