SQL Server :: Combine Two Self Referencing Queries In A Function?

Feb 23, 2011

I have a menu table which has a (mostly) unlimited number of levels/tiers:

[Code]....

I also have a working function which will give the up and down tiers based on a given MainMenuId:

[Code]....

My question is, is there a better way to do this such as combining the two querries? Every attempt I have made results in a "The Statement terminated. The maximum recursion 100 has been exhausted before statement completion"

View 4 Replies


Similar Messages:

SQL Server :: Combine Two Queries In One Resultset?

Sep 6, 2010

I want to combine two queries like :

select name as name1 from table1 where id = 6

and

select name as name2 from table1 where id = 2.

I need a single resultset. How can I do that?

View 26 Replies

SQL Server :: How To Combine Multiple Rows Into A Comma-delimited List In Sql Server In Build Function

Jan 10, 2011

How can I combine multiple rows into a comma-delimited list in sql server in build function?? in HCL

examples :

X
---
12
15
18
20

Output : 12, 15, 18, 20

with in build function of sql server.

View 6 Replies

ADO.NET :: Combine 2 Linq Queries?

Jul 27, 2010

Is it possible to combine these 2 linq queries ?

[Code]....

View 2 Replies

DataSource Controls :: Combine The LINQ Queries Together And Have Access To Both Of The Results Independently?

Feb 25, 2010

Is there a way to combine the LINQ queries together and have access to both of the results independently?

[Code]....

View 10 Replies

Combine Alert Popup In Save As File Function In C#?

Jul 17, 2010

I'm tring to write a function that need to save a file (in csv) and has a condition.

it's something like that:

If the file is small then 1MB then I want to pop up an alert in javascript and then continue with the save as file commands.

What I did was:

if(...)
{
}
else
{
ClientScript.RegisterStartupScriptBlock(...alert('aaa')...);
}
Response.ContentType = "text/csv";
Response.AppendHeader("Content-Disposition","attachment; filename=file.csv");
Response.TransmitFile("FILE.csv");
Response.End();

the save as works fine. but the alert wont popup in the else case. I tried RegisterStartupScript. I tried many options. But it seems that the response.end is stops the clientscript from happening.

I am writing in c# asp.net (ajax enabled website, but not in use), visual studio 2005.

View 1 Replies

Using The IEnumerable Function Intersect() To Combine A Few List And Get The Similar Integers?

Jun 2, 2010

I would like to use the IEnumerable function Intersect() to combine a few list and get the similar integers from each list. The problem I'm faced with is that I don't know how many list I will need to compare.

Here is an example:

A{1,2,3,4}
B{1,2,3}
C{1,2}

results = A.Intersect(B).Intersect(C)

This works great, but the next time around I may have a D{1,2} next time I come across the function.

I'd like to use the Intersect method, but I'm open to new ideas as well.

View 1 Replies

SQL Server :: Combine Two Querys Into One?

Feb 9, 2011

My query below

SELECT
WORKORDER
WORKORDER
[dbo]
WORKORDER.ACCT, MASTERFI.NAME1,
.TICKET_RECV_DT, WORKORDER.WORK_ORDER_NUM,
.LAST_ACTION,WORKORDER_DETAIL.WORKER
FROM [dbo].WORKORDER,
.MASTERFI, [dbo].WORKORDER_DETAIL.......

I want to combine two querys into one, how do i achieve this result?

View 4 Replies

SQL Server :: Combine Two Rows Of Data?

Mar 9, 2011

have a complex sql stored procedure which involves several unions.The unions also involveat from views. When the data is returned, it might look like the following.

ProductId Name Amount Buyer Date YearsAsCustomer
1 Jones 234.44 Nichols
1 Jones 3/12/2011 3
2 Melon 333.00 Tripol
2 Melon 3/23/2011 4

This is just a simple example, but notice how the records with the same product Id can be combined?Because one record has some of the data I need and the other record has different data. So essentiallythey should just be in one record together. So the output should look like this:

ProductId Name Amount Buyer Date YearsAsCustomer
1 Jones 234.44 Nichols 3/12/2011 3
2 Melon 333.00 Tripol 3/23/2011 4

How can I combine these records together? In the stored procedure the query is build in a parameter stringnamed @SQL, and then the query is executed by using the EXEC command:EXEC sp_executesql @SQL.Is their anway I can combine all of the outputted records into one record. Where the records I want to combine
have the same ProductId (As in the example I illustrated above?)

View 7 Replies

Referencing A Text File On A Web Server?

May 26, 2010

I have a web site that is hosted by Network Solutions. The hosting package I have includes support for ASP. I can place a simple aspx page on my web site and point to it with my browser and it appears to execute. What I'd like to do is reference a text file (for parsing) that is in the same folder as the aspx file. I have no idea what the absolute path is to the folder. How can I reference the file for reading if I don't know the absolute path?

View 3 Replies

SQL Server :: Combine Inner Joins - Get A Field Value From The First Statement

Sep 14, 2010

I have a select statement. I need to get a field value from the first statement. GOAL: Below is what I am trying to accomplish - the code below is not correct - Please modify the statement with the correct SQL Syntax. I want to query a table and based on the results I want to set the "If THE Else"statement to query then table with diffent inner joins.

SELECT * FROM CONTENTITEM CI
INNER JOIN CONTENTCATEGORY CC ON CI.CATEGORYID = CC.CATEGORYID
IF CI.FORMTYPE = 200 OR 300
SELECT * FROM CONTENTITEM CI
INNER JOIN CONTENTCATEGORY CC ON CI.CATEGORYID = CC.CATEGORYID
INNER JOIN CONTENTFORMFIELD CF ON CF.ITEMID = CI.ITEMID
WHERE CI.ITEMID = @ITEMID
ELSE
SELECT * FROM CONTENTITEM CI
INNER JOIN CONTENTCATEGORY CC ON CI.CATEGORYID = CC.CATEGORYID
WHERE CI.ITEMID = @ITEMID

View 10 Replies

SQL Server :: Can Combine Resultset Return By Union

Sep 30, 2010

Is there a way to row two and three of the result set be returned so that the

following query:

[Code]....

View 10 Replies

SQL Server :: Stroed Procedure To Combine String And Int?

Jul 20, 2010

I am wanting to produce and SQL stored procedure that will combine a the CompanyID with the CompanyName I order to display this in a drop down list/This is what i have so far....

Select CompanyID + ' - ' + CompanyName As DisplayName, CompanyID From Company

The error I get says:

"Conversion failed when converting the nvarchar value 'testcompany' to data type smallint."

Now Im presuming this is caused by the CompanyID being an int and the CompanyName being a string.

View 2 Replies

SQL Server :: Connect Two Queries Beside Each Other?

Sep 14, 2010

I have to subqueries and i need them to be sidebyside but when i "union all" one goes under.

What is the way i can have them appear beside each other?

View 5 Replies

SQL Server :: How To Union Two Queries Without Duplicates

Aug 27, 2010

I have a sql query that returns 4 columns CustName CustId CustZip CustPhone

I have a second sql query that returns the following 5 columns

CustName CustId CustZip CustEmail CustAddress

Both queries, query different data tables in the database, but return columns that are common to

both.

How do I union the two queries(Assuming a union is needed)

Which will result in no duplicates and an end result being the following output:

CustName CustId CustZip CustPhone CustEmail CustAddress

As you can see we want to not have duplicate values on output. So something like the following
is not acceptable:

Jeff Stamper 2222234 81224 498-300-2222
Jeff Stamper 2222234 81224 498-300-2222 js@jj.com 122 Mars Blvd
Karen Bops 3322234 81666 498-300-2222
Karen Bops 3322234 81666 498-300-2222 kb@lpo.com 322 Jamer Road

View 4 Replies

SQL Server :: Run Multiple MS Update Queries

Sep 11, 2010

On satisfying the If condition, I need to run 2 MS SQL update queries. How can I accomplish this? I am using C# as the server side language.

View 6 Replies

SQL Server :: SUM In Multiple Queries Of Each Table

Dec 21, 2010

I want to find the sum of each tables fileld. how can do this. i tried the following.but could nt get the correct sum. "SELECT SUM(gb) FROM data20 union all SELECT SUM(gb) FROM data10 union all SELECT SUM(gb) FROM data5 union all SELECT SUM(gb) FROM data6"

View 7 Replies

AJAX :: Combine Libraries Into 1 Js file To Reduce Requests To Server?

Jan 27, 2011

I am using ajax control toolkits and ajax extentions in my projects. and as you know it overhead some libraries to page. How can I combine them into 1 js file to reduce requests to server ???

View 2 Replies

SQL Server :: How To Debug Queries And Stored Procedures

Mar 24, 2011

How to debug queries and stored procedures in sql server 2008 like we doing in vs

View 1 Replies

Combine JQuery Client And Server Side Errors In Same Summary At Top Of Page

Feb 25, 2010

I am using JQuery for all of my client side validation and Asp.net validator controls for all of my server side validation. I am using an errorlabelcontainer to store the client side validations in a summary at the top of the page, which is the requirement. All works well. My problem is, I want to display the server side asp.net errors in the same errorlabelcontainer OR display all of the client side errors in the validation summary. Either way, Both errors need to be in the same place/div. Any ideas on how to do this? I thought of maybe using the asp.net validation summary as the errorcontainer in JQuery, but I cannot find the summary. This is what I have right now.

$("#aspnetForm").validate(
{
onkeyup: false,
errorLabelContainer: $("ul", $("#FormErrors")),
wrapper: "li"
});

If you need to see more code.

View 1 Replies

SQL Server :: How To Combine The Data From The Two Text Boxes And Store It In Single Column

Jul 30, 2010

I have two textboxes

1.To get the Hour

2.To get the Minutes

From user.

And in the back end... i would to Combine the data from these text boxes and store it in single column..
For eg.

If textboxHours.Text="11";
textboxMinuetes.Text="56";
In the backend it should store like..
MeetingTime (column name)
11.56

View 2 Replies

SQL Server :: Combine Strings Separated By Single White Space In Column

Mar 10, 2011

i have a column in table and need to combine words seperated by single space, i am using sql server 2005.

DECLARE @text varchar(256)
SELECT @text = 'Micro Tech'

--required output MicroTech

View 3 Replies

SQL Server :: Run Multiple Queries On Single Button Click

Jan 29, 2011

how to run multiple queries on a single button click. Actually I want whatever a user write in text box and click the button the text would get inserted in table category and also a table name project should get updated. I am using Sql server 2005 and c#

View 2 Replies

SQL Server :: Can Execute Different Queries In A Stored Procedure Same Time

Jan 11, 2011

In my stored procedure there are 8 queries for 8 tables.Each query has joins and sub queries. I am passing parameters & stored procedure name from front end(designed in asp.net 3.5) can we execute that 8 queries at the same time i.e. parallel execution so that I can minimize stored procedure execution time?

View 6 Replies

Quarantine SQL Server Queries In 3.5 - Set A Particular Db / Connection String To Timeout After X Seconds?

Nov 15, 2010

Alright, we have two database servers, one is owned by us, one owned by a partner. Our partners have been having issues lately that have been causing us numerous sql timeout errors, which takes down our whole system. We'd prefer to limit the time those queries can take to say 20 seconds max, otherwise quit trying and throw the error (which we can catch with a try/catch block). Couple of questions: Is there a way to set a particular db/connection string to timeout after X seconds? Is this the best way to quarantine that other system? or are there better ways to go about this?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved