Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - Tuesday, September 29, 2009
Blog
 
# Tuesday, September 29, 2009

For Example:

Number Value.....
1          AD
2          GD
2          DE
3          IF
4          OG
4          JD

The output I would like is:-

1         AD
2         GD,DE
3         IF
4         OG,JD

You can also resolve this problem using function.

Create Function Concat( @iNumber int )
RETURNS varchar(500)
AS
BEGIN
 
   DECLARE @List varchar(500)
   SET @List = ''
   Select @List = @List + strValue + ',' from Testing
   Where Number = @iNumber
   RETURN LEFT(@List,LEN(@List)-1)
End

And use this function in SQL Query.

select Number, dbo.Concat(Number) from Testing Group By Number

Tuesday, September 29, 2009 3:46:35 AM (GMT Daylight Time, UTC+01:00)  #    Comments [1]   SQL Server  | 
# Tuesday, August 11, 2009
In case, when you are facing colspan problem in datagarid paging section, then use this code to correcting colspan problem.
 
protected void dGrid_PreRender(object sender, EventArgs e)
        {
            try
            {
                DataGrid dgSidDetails = (DataGrid)sender;
                //Fix for numbering being in a left aligned column
                //For some reason, the ColumnSpan property is ignored andnot rendered
                    //unless set using the Attributes
                    if (dgSidDetails.AllowPaging == true && dgSidDetails.AutoGenerateColumns ==    false)
                    {
                        //Get the Table
                        System.Web.UI.WebControls.Table tab =
                            (System.Web.UI.WebControls.Table)dgSidDetails.Controls[0];
                        //Change the Top Pager
                        if (dgSidDetails.PagerStyle.Position == PagerPosition.Bottom ||
                            dgSidDetails.PagerStyle.Position == PagerPosition.TopAndBottom)
                        {
                            tab.Rows[tab.Rows.Count -
                                1].Cells[0].Attributes.Add("colspan",
                                tab.Rows[1].Cells.Count.ToString());
                        }
                        //Change the Bottom Pager
                        if (dgSidDetails.PagerStyle.Position == PagerPosition.Top ||
                            dgSidDetails.PagerStyle.Position == PagerPosition.TopAndBottom)
                        {
                            tab.Rows[0].Cells[0].Attributes.Add("colspan",
                                tab.Rows[1].Cells.Count.ToString());
                        }
                    }
            }
            catch (Exception ex)
            {

            }
        }
Tuesday, August 11, 2009 12:29:41 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ASP.NET  | 
# Friday, August 07, 2009
SELECT COUNT(*) AS Total FROM syscolumns WHERE (name = 'clientID')
Friday, August 07, 2009 12:34:54 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 
# Thursday, August 06, 2009

'Count': Counts the number of non-null values.


'Count (*)': Counts the number of rows in the table, including null values and duplicates.

Thursday, August 06, 2009 12:33:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 
You can create local and global temporary tables. Local temporary tables are visible only in the current session; global temporary tables are visible to all sessions. Prefix local temporary table names with single number sign (# table_name), and prefix global temporary table names with a double number sign (##table_name).
Thursday, August 06, 2009 12:32:53 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 

Views or tables participating in a view created with the SCHEMABINDING clause cannot be dropped. If the view is not created using SCHEMABINDING, then we can drop the table.

Thursday, August 06, 2009 12:31:58 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 

Stored procedures are nested when one stored procedure calls another. You can nest stored procedures up to 32 levels.

Thursday, August 06, 2009 12:31:01 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 
# Wednesday, August 05, 2009
Maharshi Dayanand Saraswati University (MDS) Rohtak, online counseling for B.Ed course from  5th August - 17th August 2009 on http://www.hrybedcounselling2009.nic.in/

From 16th August - 19th August 2009, the candidates can download their admission letters and report at the respective allotted colleges for verification of documents and depositing the fees.

MDU Rohtak B.Ed Counselling details are available on MDU Rohtak Website -

http://mdurohtak.com/

Direct Link to MDU Rohtak B.Ed Counselling Details -

http://mdurohtak.com/Site/Details.aspx?pid=H&id=12
Wednesday, August 05, 2009 5:39:02 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2]   General  | 
# Wednesday, July 15, 2009

• The sp_recompile system stored procedure forces a recompile of a stored procedure the next time it is run.

• Creating a stored procedure that specifies the WITH RECOMPILE option in its definition indicates that SQL Server does not cache a plan for this stored procedure; the stored procedure is recompiled each time it is executed. Use the WITH RECOMPILE option when stored procedures take parameters whose values differ widely between executions of the stored procedure, resulting in different execution plans to be created each time. Use of this option is uncommon, and causes the stored procedure to execute more slowly because the stored procedure must be recompiled each time it is executed.

• You can force the stored procedure to be recompiled by specifying the WITH RECOMPILE option when you execute the stored procedure. Use this option only if the parameter you are supplying is atypical or if the data has significantly changed since the stored procedure was created.

Wednesday, July 15, 2009 2:04:06 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 

You can use the sp_procoption system stored procedure in master database to mark the stored procedure to automatic execution when the SQL Server will start.

Wednesday, July 15, 2009 2:03:04 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question SQL  | 
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: