Click here to Skip to main content

Articles by Elina Blank (Tip/Tricks: 6)

Tip/Tricks: 6

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

Average tips rating: 4.70

Database

Get Column values as comma seperated string [Tip/Trick]
Posted: 13 Apr 2012   Updated: 13 Apr 2012   Rating: 5.00/5    Votes: 3   Popularity: 2.39
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

Query for running total in SQL Server [Tip/Trick]
Posted: 24 Aug 2011   Updated: 24 Aug 2011   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]
Always close your cursor [Tip/Trick]
Posted: 13 Oct 2011   Updated: 13 Oct 2011   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
Always close your cursor [Tip/Trick]
Posted: 13 Oct 2011   Updated: 13 Oct 2011   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...
Always close your cursor [Tip/Trick]
Posted: 18 Oct 2011   Updated: 18 Oct 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
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...
How to do a "LastIndexOf" in sql [Tip/Trick]
Posted: 31 Jan 2012   Updated: 31 Jan 2012   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
sometimes we need last occurance of the character in the string

Elina Blank

Software Developer (Senior)
The Code Project
Canada Canada

Member

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
Web04 | 2.5.120517.1 | Last Updated 26 May 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid