SQL Server :: Getting Data From Sproc With Two Selects?

Oct 11, 2010

Anyone know how to do this? I was thinking about making a sproc with something like

select * from users where @group not in member_of
select * from users where @group in member_of

Since I'm dead tired, that's not supposed to be a real query...just an approximation ;)

View 4 Replies


Similar Messages:

SQL Server :: Pass Values To Sproc From Sproc?

Jan 9, 2011

[Code]....

pass values to sproc from sproc?

View 6 Replies

SQL Server :: Sproc Getting Data From Another Database?

Dec 2, 2010

In my project, I've been told to create a sproc to get some data. Fine. No problem. However, as we're moving away from a solution created by an external consultant I've had to spend a couple of days trying to figure out how the tables are linked. Sure... However, the big problem is that since this consultant is not supposed to know about this move just yet, I've been told to put my sproc in our production database (same server), and I've been unable to find any good info on this on google S

View 8 Replies

SQL Server :: Make 'providing Data To Parameter In Sproc Optional'?

Feb 3, 2011

i have a stored procedure with multiple parameters. and several statement which utilities a specific set of queries. therefore, every time its not necessary data will be passed through the parameters, so how can i make "providing data to parameter" optional

My stored procedure:

[Code]....

View 2 Replies

SQL Server :: Modfiy A Membership Sproc?

Feb 23, 2011

I have been trying to get this sproc to return all users if null is passed to it from @UserName and a single users if a username is passed to @Username.Can anyone see where I'm going wrong?

[Code]....

View 5 Replies

SQL Server :: SET Statement In Sproc Not Working?

Sep 23, 2010

[Code]....

I want to keep the old password if the user leaves the password field blank, otherwise store the new password.

I have also tried "IS NOT NULL" instead of "= NULL", but without success. I've tried to send in an empty string and a DBNull value but it never keeps the old password.

View 2 Replies

SQL Server :: How To Receive An Output Resultset From A Sproc

Dec 26, 2010

i want to get first picture of any album in photo table. i want get output table for show to the datalist control.i need to get albumid in output

so i create a sproc similar this:

create PROC USP_GETFirstPhoto
@ALBUMID INT OUTPUT,
@CATEGORY NVARCHAR(50) OUTPUT ,
@CAPTION NVARCHAR(50) OUTPUT
AS
SELECT @ALBUMID = A.AlbumID,@CATEGORY=A.Category,@CAPTION=TMP.Caption FROM Albums A
CROSS APPLY
( SELECT top 1 * FROM Photos
WHERE AlbumID=A.AlbumID
)TMP
order by A.AlbumID
DECLARE @x INT,@y NVARCHAR(50),@z NVARCHAR(50)
EXEC USP_GETFirstPhoto @x output,@y output,@z output
select @x,@y,@z

but when i exec this proc i have a recorde not a result set

with this query i have resultset

SELECT * FROM Photos
CROSS APPLY (
SELECT TOP 1 AlbumID FROM Photos
GROUP BY AlbumID)TMP

View 16 Replies

SQL Server :: Selects Records From Some Tables And Insert Them In One Other Table?

Dec 14, 2010

I have a simple sql that selects records from some tables and insert them in one other table.This is what we need to do on a daily basis and we need to create a sql job for this.

View 3 Replies

SQL Server :: How To Pass All In A Column To A Variable Inside A Sproc

Jan 7, 2011

I have a table with about 300 OrgID's that I would like to pass into this sproc as the @Org_ID, so I don't have to do them one at a time. How would I do that?

insert into tblRelClients (client_ID, clientRel_ID)

select c1.client_ID, c2.client_ID from tblclients c1 inner join tblclients c2 on c2.OrgID = c1.OrgID
where c1.OrgID = @Org_ID

View 6 Replies

SQL Server :: Call SPROC From Web Application With Temp Table?

Jul 22, 2010

I'm trying to call a linked server, SS2000 that has NText field and instert that data into an nvarchar(120) field on SS2008.

If I execute the SPROC from SS2008 Management Studio, it works fine. If I try to call the SPROC from my ASP.NET 3.5 web application, I don't get any errors, but the data doesn't get updated.

I'm using the following SPROC:
CREATE PROCEDURE [dbo].[usp_UpdateMilestoneDescription]
@UID int
AS
BEGIN

[Code]....

View 7 Replies

Forms Data Controls :: Getting ListBox Value That The User Selects?

Apr 3, 2010

using vb.net/asp.net 2008

I have a listbox and i want to use javascript to get the value that the user selects and load the selected name value into a textbox.

I am looking for the javascript event to use for this, does anyone know what that is?

View 3 Replies

Web Forms :: GridView Data / Table That It Selects From Database?

Mar 23, 2010

out of this code, do i see what table that it selects from my database?

[Code]....

View 9 Replies

Forms Data Controls :: Detailsview Only Coming Up For First 5 Gridview Selects?

Jan 17, 2011

I have a gridview with a select button. There are 181 records in the gridview all coming from the same database table. When I select the first 5 rows the details view comes up, but after that it doesn't show... The information that it is pulling is the same for the first 5 rows as the other 176 rows. Why won't it show the detailsview?!

View 2 Replies

Forms Data Controls :: Dropdownbox Which Selects Records Based On Criteria?

Aug 22, 2010

I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

View 7 Replies

Forms Data Controls :: DataSet With Stored Procedures (3 Selects Statements)

Dec 23, 2010

This is my stored procedures with 3 selects statements
[Code]....

Now I have to fill two dropdown from the forst 2 select statements and need to fill some label through the 3 statement for this I did this
[Code]....

Its working fine my
[Code]....

Now I want to bind others controls. But I am not getting that how dataset differentiate which data need to bind to which control. How I can do this.

View 5 Replies

Forms Data Controls :: Get The Itemindex Of A Listview When Sql Query Selects Random Records?

Nov 18, 2010

i use this query as my sql query :

SELECT TOP 5 * FROM MyTableName WHERE ID=@ID ORDER BY NEWID()

As you may know it gets 5 records by random. I use it with dataset and bind the listview to this dataset and in ItemDataBound i want to do some programming (like making some controls visible or invisible) i need itemindex.

but the question is : how can i get the itemindex of a listview when sql query selects records randomly?

View 8 Replies

Forms Data Controls :: Modify Items In Gridview When User Selects A Given Record And Store Values Back In Database

Feb 25, 2011

Using SQL and C#. I have a gridview with a template field. I need to modify the some items in the gridview when the user selects a given record and store the values back in the database. ProjectID is the unique key in the database.Gridview is done as a table. How can I do it? Here is my grid view implementation.

[Code]....

View 3 Replies

Forms Data Controls :: Master Detailed GridView Edit Selects The Wrong Row To Edit?

Mar 16, 2011

I have a page with 2 GridViews on it. The top GridView shows all the Bike Riders the bottom GridView shows all the Bike Lockers. I have set up both GridViews to be able to Edit the data. And the top GridView to Select.

When I click the Select buton on the top GridView I programically reset the DataSource for the bottom GridView to show the Locker for the Biker of the top GridView Selected.

So far everything works great. I select a Biker on the Top GridView and the Bottom GridView resets just showing one record for the bike locker.

The problem is that if I then click on the Edit button on the bottom GridView (The Bike Locker GridView) the GridView goes into the Edit Mode but it now shows all the Bike Locker records and the edit record is always the top record of the GrdView.

Here is my code Behind:

[Code]....

View 1 Replies

Forms Data Controls :: Change The Contents Of A Dropdownlist When A User Selects Option 0 = "Other"

Nov 2, 2010

I'm attempting to change my select statement when a selection of "Other" is detected. The problem is that the select that executes on the page is always the original selection from the datasource definition. I've found an example where the "SelectCommand" value is changed in the code behind, but it is for a case where the dropdownlist is not in a template. I'm thinking that I have to bind to the template, but I'm not getting it to work. (see the last couple of lines in the Page_Load code)

asp code:

<div>
<asp:DetailsView AutoGenerateRows="False" DataKeyNames="EmployeeTimeId" DataSourceID="sdsEmpTimeDetailsView"
DefaultMode="Insert" HeaderText="Add EmployeeTime"
runat="server"
AutoGenerateInsertButton="True"

[Code]....

View 4 Replies

Forms Data Controls :: Adding Controls To A Webpage Based On The Results Of A SQL Sproc

May 11, 2010

Depending on the data returned from a Stored Procedure, I need to add specific controls to a page and then when they are populated by the user, write them back to the database. What is the easiest way of doing this?

View 9 Replies

Forms Data Controls :: Calendar Control Where A User Selects A Date And Then Inputs Info Into A FormView Control?

Sep 7, 2010

I have a calendar control where a user selects a date and then inputs info into a FormView control. Underneath the FormView is a GridView that shows all data from the SelectedDate on the calendar control. However, when the date is selected, all the information from the table ( from all dates ) is displayed.

[Code]....

And the code behind:

[Code]....

View 4 Replies

ADO.NET :: How To Deal With Nested Selects

Jan 14, 2011

I have two tables that effectively have a many to many relationship between them. Effectively I want to perform a query that returns results just from Table2. For simplisity table2 has 4 fields: theId, ForeignId, Info, extra

In table2 there can be multiple records with the same value of ForeignId (but each will have a unique theId which is the tables primary key).

I want to perform a:

select top (1) * where ForeignId=x order by extra

which will select 1 record for a given ForeignId

However, I then want to wrap that within an outer query where I have a list of foreignId (ie where ForeignId in ListOfX) but I want to return 1 result record for each value of foreignId. Does that make sense? So the result will be a set of records with one record for each value of foreignId and that record would have 'info' from the top(1) record from the inner query.

View 3 Replies

ADO.NET :: Call A Sproc On BtnDelete_Click?

Dec 2, 2010

I've built a Formview, but need to implement some back end functionality - I have a dataset with stored procedures, and am using ObjectDataSources. I've put an asp:button on the page and called it btnDelete, but how do I call the stored procedure ?

Something along the lines of

[Code]....

I want to be able to click on the Delete button, and have it call the stored procedure to delete the record from the dataset...but I don't know C# well enough to be able to work out what the code should be..

View 3 Replies

Web Forms :: Why SPROC Inserting Two Records Instead Of One

Oct 13, 2010

Why am I getting two records inserted into the table, when I'm expecting and needing one? The VB code below is checking whether the HTTP is secure or not, and if it is then execute the SPROC. But for whatever reason, I'm getting two records inserted about 5 seconds apart. Does anyone know why and how to fix? I just need one record.

SPROC [Code]....

VB [Code]....

GLOBAL.ASAX [Code]....

View 4 Replies

VS 2008 - How To Call A Sproc Over And Over With Sqldatasource

Apr 13, 2010

I have a list of numbers I need to submit one at a time to a stored procedure to add to a table. I don't know any other way around this. The database for this is an AS400 so it's not like using mssql server. I have a connection string and use the SQLDatasource controls to select data because I can select a stored procedure with it to call. Now I need to do an update and if it was just one time of submitting information I would do it the same way. But I need to submit each number till I do them all. How can I do this? Do I still use a sqldatasource control and set the value to be pulled from like a session var and just loop through setting the session and then sqlds.databind over and over? I added a DBML but can't do that with the as400 stored procedures as far as adding them like I do mssql.

View 5 Replies







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