Workflow Soluiton

 View Only
  • 1.  How to create/use SQL Generator when PK is UNIQUEIDENTIFIER with newid() as default value?

    Posted May 05, 2011 04:26 AM

    For now i've hooked up a "Create Globally Unique" component to populate the id field.

    Just thought there be a more 'built in' method, for a standard pratice.

     

     



  • 2.  RE: How to create/use SQL Generator when PK is UNIQUEIDENTIFIER with newid() as default value?

    Posted May 05, 2011 07:29 AM

    What exactly are you trying to accomplish? If it's an INSERT, you could use the Query/Script generator and omit the PK from your INSERT statement.

    Assuming id is your PK, with col1, col2... coln, make your INSERT statement:

    INSERT into blah (col1, col2, coln) VALUES (@col1, @col2, @coln)



  • 3.  RE: How to create/use SQL Generator when PK is UNIQUEIDENTIFIER with newid() as default value?

    Posted May 06, 2011 05:37 AM

    I was trying to use just a table generator component, rather than two generators(or more) for one table.

    I think its easier just to use a Table Generator, and Add Data + Gen GUID components then to add another intergration....

     

    Its a shame the Table Generator doesent seem to be aware of default values for columns, after all default column values are supposed to make SQL integration easier

     



  • 4.  RE: How to create/use SQL Generator when PK is UNIQUEIDENTIFIER with newid() as default value?

    Posted May 17, 2011 03:28 PM

    When you set the default for inserts to newid(), just like making a datetime column have a default binding of getdate() or getutcdate() you can just not map it when you setup the mapping for the write to database component and it will randomly generate your ID... there's no need for the extra component. If you're having to use a generate GUID component and map it together, you've done something wrong somewhere.