.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

is there alternate solution for CURSOR?

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Sql Server
 
/* CREATE TABLE X (UID INT, COL_N VARCHAR(50), COL_D VARCHAR(50)) INSERT INTO X VALUES (3, 'S_NAME', 'VARCHAR(50)') INSERT INTO X VALUES (5, 'S_ROLL', 'DECIMAL(15, 0)') INSERT INTO X VALUES (8, 'S_MARKS', 'INT') INSERT INTO X VALUES (9, 'S_SCHOOL', 'VARCHAR(100)') SELECT * FROM X CREATE TABLE Y (UID INT IDENTITY(1,1), S_NAME VARCHAR(50), S_ROLL DECIMAL(15, 0), S_MARKS INT, S_SCHOOL VARCHAR(100)) INSERT INTO Y VALUES ('AYAZ', 10, 99, 'ZINQ') SELECT * FROM Y CREATE TABLE Z (UID INT, COL_N VARCHAR(50), COL_D VARCHAR(50), COL_V VARCHAR(50)) */ DECLARE @vSQL NVARCHAR(MAX) DECLARE @UID INT DECLARE @COL_N VARCHAR(50) DECLARE @COL_D VARCHAR(50) DECLARE cur CURSOR FOR SELECT UID, COL_N, COL_D FROM X ORDER BY UID OPEN cur FETCH cur INTO @UID, @COL_N, @COL_D WHILE(@@FETCH_STATUS=0) BEGIN SET @vSQL = 'INSERT INTO Z (UID, COL_N, COL_D, COL_V) SELECT ' + CAST(@UID AS VARCHAR) + ',' + '''' + @COL_N + '''' + ',' + '''' + @COL_D + '''' + ',' + @COL_N + ' FROM Y ' EXEC SP_EXECUTESQL @vSQL PRINT @vSQL FETCH cur INTO @UID, @COL_N, @COL_D END CLOSE cur DEALLOCATE cur SELECT * FROM Z


View Complete Post


More Related Resource Links

Cursor Takes Too much time any Solution Please???

  

Hii,

       I have 2 multiple Cursors below i shows code of cursors. I have 8000 records in one cursor it's shown below.so when i execute  this sp it will take more then 7 minutes is there any solution to decrease that time.


Declare Asset_Cursor Cursor LOCAL  For   Select Acc_Id,Shift_1_Per,Shift_2_Per,Shift_3_Per From Tbl_Acc_Master Where CoCode=@CoCode  (Cursor1 only 4 to 5 records)
            Open Asset_Cursor
            Fetch Next From Asset_Cursor Into @Acc_Id_Cur,@Shift_1_Per,@Shift_2_Per,@Shift_3_Per
            While @@Fetch_Status = 0                   
            Begin

Declare Item_Cursor Cursor LOCAL  For

                                Select AssetCode,PlacedIntoService,BookValue From dbo.tblAssetItemMst Where Acc_Id=@Acc_Id_Cur And BranchCode=@BranchCode And CoCode=@CoCode And LocationCode = IsNull(@LocationCode,IsNull(LocationCode,0)) 

Complete SQL Solution

  
SQL Server Solutions: SQL Server 2000/2005 Related Free Snippets.

Cursor Functions

  
A cursor allows looping through a record set and performing a certain operation on each record within the set. SQL Server supports three functions that can help you while working with cursors: @@FETCH_STATUS, @@CURSOR_ROWS and CURSOR_STATUS. Cursor functions are non-deterministic.

DECLARE CURSOR in Transact-SQL

  
Defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates. DECLARE CURSOR accepts both a syntax based on the ISO standard and a syntax using a set of Transact-SQL extensions.

Solution/project structure

  

Hello, I am working in a aspx web application that must be built in several separate "modules" with different functionality which will be partly developed by different teams.

However, I need the completed app to reside in ONE virtual directory. There will be a single startup page. I need session state to be preserved across pages in different modules.

I structured it as one solution with different Web Projects and one class library project with common functionalities.

Questions:

1) is this the right approach to do this? Or which one would be better?

2) each time I add a new web project to the solution, a new web.config gets created. What do I do and where do I put them?

VS 2010 + framework 4.0 + TFS

Regarding TFS and source control, I have a single Team project, the solution and web projects are inside it.

 

Thanks!


Arabic QueryString with Url Rewrite Solution

  

Alsalamo 3alaykom ,


as we know that if you use Intelligencia.UrlRewriter.RewriterHttpModule or IIS URL Rewriting , we will face problems with arabic urls

as this


http://localhost:1234/Pages/???? ?????? ?????? ??????????

and the Rule is :


<rewrite url="~/Pages/(.+)" to="~/ShowPages.aspx?Page=$1" />



you will recive the QueryString["Page"] Like this

نائب العميد للشؤون الأكاديمية

so it's a big problem , and there is a solution that is :


remove the Rule of that rewriting ,,

<rewrite url="~/Pages/(.+)" to="~/ShowPages.aspx?Page=$1" />



then open your Global.asax file and Application_BeginRequest method exactly


use the following code to handle you request



void Application_BeginRequest(object sender, EventArgs e)
{
if (HttpContext.Current.Request.Url.ToString().Contains("/Pages/"))
{
	String[] txt= Regex.Split(HttpContext.Current.Request.Url.ToString(), @"/");
	String page = txt[txt.Length-1];
	HttpContext.Current.RewritePath("~/Sh

AD FS 2.0 in Identity Solutions: Using Active Directory Federation Services 2.0 in Identity Solution

  

This article explains how you can use Active Directory Federation Services (AD FS) 2.0 to claims-enable Windows Communication Foundation (WCF) services and browser-based applications. The focus is on the token issuance functionality in AD FS 2.0. You'll find out how to use AD FS 2.0 as an identity provider; set up an AD FS 2.0 security token service (STS) to interact with WCF; federate AD FS 2.0 with your custom STS or another AD FS 2.0; enable Web single sign-on and federation with WS-Federation and SAML 2.0 protocols; and externalize authentication logic through Visual Studio. You'll come away appreciating how AD FS 2.0 and Windows Identity Foundation make programming identity solutions in Windows less of a chore.

Zulfiqar Ahmed

MSDN Magazine November 2009


BizTalk EDI: Build a Robust EDI Solution with BizTalk Server

  

We introduce you to the EDI functionality within BizTalk Server 2006 R2, illustrating schema creation, document mapping, EDI delivery and transmission, and exception handling.

Mark Beckner

MSDN Magazine August 2008


Security: Safer Authentication with a One-Time Password Solution

  

One-time passwords offer solutions to dictionary attacks, phishing, interception, and lots of other security breaches. Here's how it all works.

Dan Griffin

MSDN Magazine May 2008


Office Development: OBA Solution Patterns In The Real World

  

OBA solution patterns help architects and developers build Office Business Applications (OBAs). This article introduces the seven core OBA solution patterns and applies one to a real-world problem.

Steve Fox

MSDN Magazine March 2008


Office Space: Solution Deployment with SharePoint 2007

  

WSS 3.0 introduces a new deployment mechanism that lets you move your development efforts into a staging or production environment.

Ted Pattison

MSDN Magazine August 2007


Extreme ASP.NET: A New Solution to an Old State Storage Problem

  

State management in Web applications is a contentious issue. Should you store user data per session or should you persist it across sessions? You can easily store information temporarily while someone navigates your site by using session state.

Fritz Onion

MSDN Magazine April 2006


Inside MSDN: Using InfoPath as a Reporting Solution

  

I love the part of my job that lets me write code and develop software. In addition to those responsibilities, however, I manage a development organization that's working on a number of large strategic projects.

Larry W. Jordan Jr.

MSDN Magazine March 2005


Win32 Resources: Using C++ to Programmatically Retrieve a Global Cursor's Shape and ID

  

Getting global cursor information is useful when developing software that drives or gathers information about other UI-based applications, including information about a remote machine. This article describes a way to programmatically identify the current cursor's ID and bitmap at any point in time. The first technique described is based on polling for information and shows how to get the handle of the current global cursor. This handle will then allow you to get information about the cursor. You can also monitor WinEvents for changes to the global cursor.

Dmitri Klementiev

MSDN Magazine October 2001


Build Solution

  

 I am following the tutorial http://www.asp.net/mvc/tutorials/mvc-music-store-part-2 and am at the part where I need to build the solution...

When I click the build option at the top I do not get the same menu items...

I get:

 

Build <Project Name>

Rebuild <Project Name>

Clean <Project Name>

Publish <Product Name>

 

It doesn't even show the shortcut keys next the the menu items, like Build <Project Name> should show Shift+F6

 

I have wen't through many options and tried using the shortcut F6 to build solution

Is there something I am missing???

 

Thanks


(Imperfect) Solution to TreeView Postback / Client-Side Node Selection Issue

  

I've seen this question posted on all corners of the web... "How do I disable "AutoPostBack" on the ASP.NET 2.0 TreeView control?!"  Unfortunately, most of the answers either don't work, miss the point (don't work right), or boil down to "You can't do it."  I happen to know that this behavior worked perfectly in the IEWebControls TreeView that Microsoft released as an add-on prior to ASP.NET 2.0, however.  So I set out to find a solution for the ASP.NET 2.0 TreeView issue.

In a nutshell, the behavior that I and others are looking for is to have a TreeView rendered in a page that allows the user to expand, contract, and select nodes within the TreeView without causing a PostBack to the server.  This implies two things: (1) the most recently-selected node should be recorded as the currently-selected node [i.e., at PostBack time, the most-recently selected node is actually represented as the SelectedNode]; and (2) the selected node should exhibit the SelectedNodeStyle as specified in the TreeView declaration.

It appears that the TreeView engineers saw only two possible outcomes from selecting a leaf node in a tree: (1) immediately posting back to the server, or (2) immediately navigating to another web page.  They apparently did not consider option (3) just allowing selection in-place on the client, while waiting for a click on so

Erro While Creating a Solution Package With a timer Job

  

Hi All,

I am trying to create a test Timer job in SharePoint and want it to be deployed as a solution package. I am using a web application project and added Timerjob.cs, fetaurereceiver.cs, feature.xml and manifest.cml files in in. Then I created a .dff file to arrange the solution package. But when I tried to create a solution package with makecab.exe i got the below error

100.00% flushing current folder

I dont know what to do with that . Please if anyone can send me an example where a timer job was deployed as a solution package it will be of great help

Thanks,

 

 


Isha kapoor My SharePoint Blog Follow me
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend