SQL Sever, NewID ()

  • Thread starter Thread starter mr.Hyde
  • Start date Start date
M

mr.Hyde

Hi,
I am working with mscrm database. the Accounts has UniqueIdentifierID,
so I am trying to use as parameter value in sqlcommand "NewId();", it doesnt
works becouse,
ExecuteNonQuery pass my parameter as "NewId();" - with quotas. How I can
remove quotas from this command?

Regards
Hyde
 
mr.Hyde said:
Hi,
I am working with mscrm database. the Accounts has UniqueIdentifierID,
so I am trying to use as parameter value in sqlcommand "NewId();", it doesnt
works becouse,
ExecuteNonQuery pass my parameter as "NewId();" - with quotas. How I can
remove quotas from this command?

Regards
Hyde

mr.Hyde,

Could you provide a snippet of code for us to look at? Without seeing
how you are coding this it's not easy to suggest a solution.

Cheers,
Steve
 
you can't because sqlserver doesn't allow expressions or fuction as
parameters. newid() is just a guid, so you can let the clr do it. define the
paramter as a UniqueIdentifier, and set its value to Guid.NewGuid()


-- bruce (sqlwork.com)
 
Back
Top