Click here to Skip to main content
11,428,004 members (57,224 online)

Articles by Elina Blank (Tip/Tricks: 6)

Tip/Tricks: 6

RSS Feed
No articles have been posted.
No blogs have been submitted.

Average tips rating: 4.75

Database
General
Posted: 13 Apr 2012   Updated: 13 Apr 2012   Views: 7,780   Rating: 5.00/5    Votes: 4   Popularity: 3.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Another option:declare @commaStringList varchar(max)set @commaStringList = ''select @commaStringList = @commaStringList + ', ' + CAST(ColumnName as VARCHAR) from MyTable -- remove leading commentif len(@commaStringList) > 3 set @commaStringList =...
Programming Tips
General
Posted: 24 Aug 2011   Updated: 24 Aug 2011   Views: 3,530   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Using window functions (partition by) will speed up the process:SELECT Val, SUM(Val) OVER (Partition BY [YourPartitionValue] Order BY [OrderColumn] as CumulativeSumFROM [Table]
Posted: 13 Oct 2011   Updated: 13 Oct 2011   Views: 28,140   Rating: 4.50/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
When cursors are inside transaction, it is sometimes easy to forget to close the cursor
Posted: 13 Oct 2011   Updated: 13 Oct 2011   Views: 1,640   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
An alternative (simpler way :) ) is:BEGIN TRANDECLARE IdCursor CURSOR FOR SELECT Id FROM MyTable OPEN IdCursor FETCH NEXT FROM IdCursor INTO @CurrentIdWHILE (@@FETCH_STATUS) = 0 BEGIN -- do work IF @@error 0...
Posted: 18 Oct 2011   Updated: 18 Oct 2011   Views: 3,260   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
To see the default value of the cursor scope:select * from sys.databases(if value of "is_local_cursor_default" is 0 then scope id global, otherwise it is local).The scope is GLOBAL by default (for compatibility reasons).To change default scope use following:ALTER DATABASE...
Posted: 31 Jan 2012   Updated: 31 Jan 2012   Views: 15,900   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
sometimes we need last occurance of the character in the string
No reference articles have been posted.

Elina Blank
Software Developer (Senior) The Code Project
United States United States
Elina joined the Code Project team as a software developer in order to make the site run even smoother than it is now. She will also take care of making wishes and promises on the site improvements come to the light sooner than later. When not at work, she enjoys being with her family and wishes there will be at least 30 hours in a day Smile | :)


Advertise | Privacy | Mobile
Web03 | 2.8.150428.2 | Last Updated 3 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid