F# SQL Type Provider Identity Insert -
i'm using f# sql type provider migrate info between 1 database another.
i need able insert identity info (numeric id column).
the schema table has id
column beingness identity.
i've run script set identity_insert
on
should fine.
the issue type-provider-generated insert doesn't bother writing id value part of statement.
is there way of forcing so?
here's did meet deadline. it's near ideal insert record 'correct' identity.
mysequence |> seq.iter (fun x -> db.datacontext.executecommand( "set identity_insert [dbo].mytable on insert mytable (id, name) values({0}, {1}) set identity_insert [dbo].mytable off", x.id, x.name) |> ignore)
edit
turns out datacontext.executecommand()
fail if 1 of parameters null
because can't infer type , assumes object
i ended switching seekwell (nuget bundle wrote) looks bit cleaner too, given don't have deal parameter ordering.
let command = new seekwell.command(destination) mysequence |> seq.iter (fun x -> command.executescalar( "set identity_insert mydb.dbo.mytable on insert mydb.dbo.mytable (id, name) values(@id, @name) set identity_insert mydb.dbo.mytable off", x) |> ignore)
sql f# type-providers
No comments:
Post a Comment