How to use an Update Cursor on MS SQL Server.
Requirements: If the update-table does not have a Primary Key, the cursor is read-only. So I advise to create at least a temporary Primary Key, and delete it afterwards.

Usage:

DECLARE curs as CURSOR
FOR SELECT * FROM t_image
FOR UPDATE

OPEN curs
FETCH curs INTO @lastValue

WHILE (@@FETCH_STATUS = 0) BEGIN

UPDATE [t_image]
SET [CALC_VALUE] = @lastValue
WHERE current of curs

FETCH curs INTO @lastValue
END

CLOSE calc
DEALLOCATE calc

if you replace “WHERE current of curs” by any “WHERE x = y” statement, it would decrease performance dramtically.

During a test with 80000 records, execution time without update cursor takes 20 minutes. Using an update cursor speeds up to a total time of 20 seconds!

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Nachdem ich nur mehr die SQL Server 2008 Tools installiert habe – gibt es Schwierigkeiten mit dem öffnen von SQLCe 3.1 Datenbanken – 2 Zeilen Code machens wieder gut. Gefunden habe ich das bei MobileTech

SqlCeEngineeng = new SqlCeEngine(@”DataSource=C:\MyDataBase.sdf”); 
eng.Upgrade(@”DataSource=C:\MyDataBaseNew.sdf”);

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

Beim druchforsten meiner Hack/DIY Seiten bin ich auf was tolles gestoßen. Gizmo ein Freeware Tool, mit dessen Hilfe man all das machen kann, was ein Developer so ab und an mal braucht. Alleine die Featureliste sollte euch doch schon mal neugierig machen.

  • Gizmo Drive (Mount ISOs, encrypted hard drive images to a virtual device,….)
  • Gizmo Database (Query Analyzer and stored procedure analyser,….)
  • Gizmo Editor (Colorizing text editor and hex/binary editor,….)
  • Gizmo Hasher (Calculates hash values for files, folders and drives,…)
  • Gizmo Script (Automate your PC and execute functions using scripts,…)
  • Gizmo Synchronization (Synchronize files and deploy software between clients)

Ach ja eine DVD/CD Brenn function ist auch einbaut. ;)

While reading my Hack/DIY sites I found something very usefull.Gizmoa freeware tool, with all the functionality a developer needs from time to time. Just read the featurelist and you know you want to have it.

  • Gizmo Drive (Mount ISOs, encrypted hard drive images to a virtual device,….)
  • Gizmo Database (Query Analyzer and stored procedure analyser,….)
  • Gizmo Editor (Colorizing text editor and hex/binary editor,….)
  • Gizmo Hasher (Calculates hash values for files, folders and drives,…)
  • Gizmo Script (Automate your PC and execute functions using scripts,…)
  • Gizmo Synchronization (Synchronize files and deploy software between clients)

Bevor I forget it, there is also a DVD/CD burning feature implemente. ;)

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg