Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Triggers with data converstion

Triggers with data converstion

Scheduled Pinned Locked Moved Database
database
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dandamudi padma
    wrote on last edited by
    #1

    Hi can anybody give solution for my req i had a mastertable and i need to copy generated recordsd to my child table my code follows in this way: CREATE TRIGGER trigInsertion on GlobalScan AFTER insert as INSERT into GlobalScanNew SELECT * FROM inserted end but here in my mastertable coloums data type is different from child table now i need to convert this and place it in my new table plz can anybody give solution for this Regards padma padma

    J 1 Reply Last reply
    0
    • D dandamudi padma

      Hi can anybody give solution for my req i had a mastertable and i need to copy generated recordsd to my child table my code follows in this way: CREATE TRIGGER trigInsertion on GlobalScan AFTER insert as INSERT into GlobalScanNew SELECT * FROM inserted end but here in my mastertable coloums data type is different from child table now i need to convert this and place it in my new table plz can anybody give solution for this Regards padma padma

      J Offline
      J Offline
      joemonvarghese
      wrote on last edited by
      #2

      hi you can use convert() function for converting data type and insert it in to the child Table. eg: INSERT INTO CHILD SELECT CONVERT(VARCHAR,FIELD1) FROM INSERTED Regards Joe

      D 1 Reply Last reply
      0
      • J joemonvarghese

        hi you can use convert() function for converting data type and insert it in to the child Table. eg: INSERT INTO CHILD SELECT CONVERT(VARCHAR,FIELD1) FROM INSERTED Regards Joe

        D Offline
        D Offline
        dandamudi padma
        wrote on last edited by
        #3

        thanks for reply but in my master table i had 10 coloums and in that i need to check three coloums so how can i do it padma padma

        J 1 Reply Last reply
        0
        • D dandamudi padma

          thanks for reply but in my master table i had 10 coloums and in that i need to check three coloums so how can i do it padma padma

          J Offline
          J Offline
          joemonvarghese
          wrote on last edited by
          #4

          hi if you needs only 3 columns specify that columns in your select qry eg: INSERT INTO CHILDTABLE SELECT CONVERT(FIELD1),CONVERT(FIELD2),FIELD3 FROM INSERTED Regards Joe

          D 1 Reply Last reply
          0
          • J joemonvarghese

            hi if you needs only 3 columns specify that columns in your select qry eg: INSERT INTO CHILDTABLE SELECT CONVERT(FIELD1),CONVERT(FIELD2),FIELD3 FROM INSERTED Regards Joe

            D Offline
            D Offline
            dandamudi padma
            wrote on last edited by
            #5

            thank you

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups