Click here to Skip to main content
15,882,055 members

Articles by Elina Blank (Tip/Tricks: 6)

Tip/Tricks: 6

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.75

Database Development
SQL Server
24 Aug 2011   Updated: 24 Aug 2011   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 11,420     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Using window functions (partition by) will speed up the process:SELECT Val, SUM(Val) OVER (Partition BY [YourPartitionValue] Order BY [OrderColumn] as CumulativeSumFROM [Table]
13 Oct 2011   Updated: 13 Oct 2011   Rating: 4.50/5    Votes: 2   Popularity: 1.35
Licence: CPOL    Views: 32,110     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
When cursors are inside transaction, it is sometimes easy to forget to close the cursor
13 Oct 2011   Updated: 13 Oct 2011   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 4,830     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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...
18 Oct 2011   Updated: 18 Oct 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 10,400     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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...
Programming Languages
SQL
13 Apr 2012   Updated: 13 Apr 2012   Rating: 5.00/5    Votes: 4   Popularity: 3.01
Licence: CPOL    Views: 17,522     Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
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 =...
31 Jan 2012   Updated: 31 Jan 2012   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 40,231     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
sometimes we need last occurance of the character in the string

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
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 | :)