Is it possible to create following query in LINQ for SQL

UPDATE Employee SET Salary= Salary * 1.5 WHERE Employee.Job='Developer'
(Don't you like this query :-)?)
Thanks,
Shimon.

Re: Bulk UPDATE in LINQ for SQL by Cowboy

Cowboy
Thu Mar 13 22:51:42 CDT 2008

LINQ is not SQL. It is designed to query, not perform bulk CRUD. You can set
up LINQ to set up the objects and then set all to the value and update, but
this is a job I think would be better performed on the datbase personally.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

*************************************************
| Think outside the box!
|
*************************************************
"Shimon Sim" <shimonsim048@community.nospam> wrote in message
news:e2FtFhXhIHA.6032@TK2MSFTNGP03.phx.gbl...
> Is it possible to create following query in LINQ for SQL
>
> UPDATE Employee SET Salary= Salary * 1.5 WHERE Employee.Job='Developer'
> (Don't you like this query :-)?)
> Thanks,
> Shimon.
>



Re: Bulk UPDATE in LINQ for SQL by Andy

Andy
Fri Mar 14 08:17:51 CDT 2008

On Mar 13, 11:51 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> LINQ is not SQL. It is designed to query, not perform bulk CRUD. You can set
> up LINQ to set up the objects and then set all to the value and update, but
> this is a job I think would be better performed on the datbase personally.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my bloghttp://gregorybeamer.spaces.live.com/lists/feed.rss
>
> *************************************************
> | Think outside the box!
> |
> *************************************************"Shimon Sim" <shimonsim...@community.nospam> wrote in message
>
> news:e2FtFhXhIHA.6032@TK2MSFTNGP03.phx.gbl...
>
> > Is it possible to create following query in LINQ for SQL
>
> > UPDATE Employee SET Salary= Salary * 1.5 WHERE Employee.Job='Developer'
> > (Don't you like this query :-)?)
> > Thanks,
> > Shimon.

Well, that's true, but you can execute the OPs sql using the
DataContext.ExecuteCommand or DataContext.ExecuteQuery methods.