How Can I Obtain The Top 3 Of A Dataset

Feb 9, 2005

If I have say 20 records of sales employees, for example, how can I get the top 3 locations for $$$sales for EACH employee? Each employee can have multiple locations where they have sold(let's say up to 50). I only want the names of the top 3 locations. The closest I can get is filtering the dataset by a HAVING clause > a dollar amount but this still gives me between 3 - 12 records for each plus I have to literally enter each salesperson's number as it stands now. Is this a loop or a cursor? Thanks.

ddave

View 14 Replies


ADVERTISEMENT

SQL Server 2008 :: Populate One Dataset In SSRS Based On Results From Another Dataset Within Same Project?

May 26, 2015

I have a report with multiple datasets, the first of which pulls in data based on user entered parameters (sales date range and property use codes). Dataset1 pulls property id's and other sales data from a table (2014_COST) based on the user's parameters. I have set up another table (AUDITS) that I would like to use in dataset6. This table has 3 columns (Property ID's, Sales Price and Sales Date). I would like for dataset6 to pull the Property ID's that are NOT contained in the results from dataset1. In other words, I'd like the results of dataset6 to show me the property id's that are contained in the AUDITS table but which are not being pulled into dataset1. Both tables are in the same database.

View 0 Replies View Related

Integration Services :: Perform Lookup On Large Dataset Based On A Small Dataset

Oct 1, 2015

I have a small number of rows in a dataset, Table 1.  There is a CLOB on a large dataset, Table 2.  They join on a PK.  I would like to retrieve this CLOB and add it to the data flow for Table1.  In short I want to emulate the following:

Table 1:  Small table without CLOB, 10 rows. 
Table 2: Large table with CLOB, 10,000,000 rows

select CLOB
from table2
where pk = (select pk from table1)

I want this to return the CLOBs for the small number of rows in Table 1.  The PK is indexed obviously so it should be a fast look up.

Table 1 and Table 2 live on different Oracle databases.  How do I perform this operation efficiently in SSIS?  It seems the Lookup and Merge Join wont do this.

View 2 Replies View Related

Reporting Services :: Populate One Dataset In SSRS Based On Results From Another Dataset Within Same Project?

May 27, 2015

I have a report with multiple datasets, the first of which pulls in data based on user entered parameters (sales date range and property use codes). Dataset1 pulls property id's and other sales data from a table (2014_COST) based on the user's parameters.

I have set up another table (AUDITS) that I would like to use in dataset6. This table has 3 columns (Property ID's, Sales Price and Sales Date). I would like for dataset6 to pull the Property ID's that are NOT contained in the results from dataset1. In other words, I'd like the results of dataset6 to show me the property id's that are contained in the AUDITS table but which are not being pulled into dataset1. Both tables are in the same database.

View 3 Replies View Related

How Can I Use SQL Reporting Services To Get A Dynamic Dataset From Another Web Service As My Reports Dataset?

May 21, 2007

I found out the data I need for my SQL Report is already defined in a dynamic dataset on another web service. Is there a way to use web services to call another web service to get the dataset I need to generate a report? Examples would help if you have any, thanks for looking

View 2 Replies View Related

Listing Datasets In Report (dataset Name, Dataset's Commands)

Oct 12, 2007



Is there any way to display this information in the report?

Thanks

View 3 Replies View Related

Obtain The Last NEWSEQUENTIALID()

Nov 14, 2006

I'm using sql server 2005, I created a customer table and set the customer_id as an uniqueidentifier that is a NEWSEQUENTIALID()...when a user is created I want to obtain the last customer_id so that I can insert it in another table that has a one to many relationship with the customer table. Please help...how do i do this?.Thanx 

View 3 Replies View Related

How Do I Obtain The Row Count

Mar 1, 2001

I'm working on a search engine right now, and I am querying out a set amount of information at one time. How can I grab the last row count of a query, and use that as a starting point, or index when a "Next 100" is pressed. For instance, a person searches through a user table, but only wants 25 users at a time. So the beginning index is 0 to 25. In my query, I have "SELECT TOP 25 from users", but now when the person searching want's to move to the next 25 users, so the index would be 26 to 50, how can I hold the last row displayed? It gets a little more complex also, if a user is searching by last name, the rows will be staggered. Is there a SQL function which will grab the number of the last row displayed? I've looked through the SQL Book, and was unable to find a function that does this, or anything close to it. I hope I made sense of this question, if you need more information, email me and I will try to clarify. Thank you for any information or hints.

View 1 Replies View Related

How Can I Obtain Message_id?

Oct 3, 2006

Hi all!

How can I obtain message_id when I SEND the message, before I execute RECEIVE statement?

Thanks a lot for the help!

View 9 Replies View Related

Dataset.Tables.Count=0 Where There Are 2 Rows In The Dataset.

May 7, 2008

Hi,
I have a stored procedure attached below. It returns 2 rows in the SQL Management studio when I execute MyStorProc 0,28. But in my program which uses ADOHelper, it returns a dataset with tables.count=0.
if I comment out the line --If @Status = 0 then it returns the rows. Obviously it does not stop in
if @Status=0 even if I pass @status=0. What am I doing wrong?
Any help is appreciated.


ALTER PROCEDURE [dbo].[MyStorProc]

(

@Status smallint,

@RowCount int = NULL,

@FacilityId numeric(10,0) = NULL,

@QueueID numeric (10,0)= NULL,

@VendorId numeric(10, 0) = NULL

)

AS

SET NOCOUNT ON

SET CONCAT_NULL_YIELDS_NULL OFF



If @Status = 0

BEGIN

SELECT ......
END
If @Status = 1
BEGIN
SELECT......
END



View 4 Replies View Related

How To Obtain Exclusive Access Via SQL

Feb 5, 2003

Hi,

i need to run a restore of a database overnight onto a different server using the live data .bak file. however the job failed on the first run (last night) with the error:

"Exclusive access could not be obtained because the database is in use. ...."

how do i gain this Exclusive use via an SQL statement please?

View 8 Replies View Related

Obtain Trusted Connection ?

Feb 2, 2006

Hi all!


I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network)
For this I installed the client tools from SQL SERVER 2000 kit. Ok.
When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password.
I mention that I set the sql server in mixed mode autentification.

When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with

sa (for example)

The question is:

How I can set up a "trusted connection" at SQL Server?



The computer is completely new, clean and has win xp with sp2.


Any opinion are considered.

Thanks in advance.


koci.

View 2 Replies View Related

Obtain Trusted Connection ?

Feb 2, 2006

Hi all!


I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network)
For this I installed the client tools from SQL SERVER 2000 kit. Ok.
When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password.
I mention that I set the sql server in mixed mode autentification.

When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with

sa (for example)

The question is:

How I can set up a "trusted connection" at SQL Server?



The computer is completely new, clean and has win xp with sp2.


Any opinion are considered.

Thanks in advance.


koci.

View 3 Replies View Related

Trying To Obtain Past Dates

Oct 5, 2006

Hi,

I have a date column and I am trying to build a query that will give me the dates > 48 hours ago (in the past).

For example using todays date 2006.10.05 and time 23:00 I would be looking for the dates prior to 2006.10.03 and time 23:00.

Your help is greatly appreciated!

Thanks!

View 2 Replies View Related

How To Obtain The Students'name With Highest GPA

Apr 12, 2006

I want to obtain the top 1 students' name in each grade,but this code
dosen't work:
select top 1 name
from student
group by grade
order by GPA desc

Can anyone tells me what to do?

View 6 Replies View Related

How To Obtain Constraint Info

Aug 7, 2005

i need to programmatically obtain and the process constraintinformation. the problem with the output from sp_helpconstraint isthat it outputs two resultsets. (the 2nd resultset is exactly what ineed though)as far as i know i can't stick this output into a temp table to thenprocess with cursors or anything like that. i'm trying to directlyaccess all kinds of sytem tables but not getting the complete info thatthe 2nd resultset that sp_helpconstraints offers.(E.g. sp_helpindex is more useful as it outputs only one resultset ofinformation so i could programmatically use that output to do what ineed to do)any suggestions? thanks.

View 1 Replies View Related

How To Obtain Constraint (key) Info

Aug 7, 2005

i need to programmatically obtain and process constraint keyinformation. the problem with the output from sp_helpconstraint isthat it outputs 2, and sometimes 3 resultsets. (the 2ndresultset/constraint_keys is exactly what i need however)because the resultsets vary in output format, i cannot programmaticallyuse the output to process in my DB proc. its essentially useless tome. i can only suppress the 1st resultset (with tablename info), andcannot suppress the occasional 3rd resultset (that has referencingforeign key info).i've tried to directly access all kinds of sytem tables but i'm notgetting the complete info that the 2nd resultset thatsp_helpconstraints offers.any suggestions? thanks.

View 3 Replies View Related

How To Obtain Just The Last Record Grouped By

Jul 20, 2005

Sorry for my englishI have a table that contains data of career about the person (staff)like this ...EMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1199912312002123111200311000321999123120021231122003110003419991231200073115199912312001131161999123120021231162003110003719991231200212311whereEMATR is a not unique key (person ID)EANID, EMEID, EGIID (assembled) are the date of the last advance ofcareerI want extract from the table below only the actual position,therefore a view that return this rowsEMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1200311000322003110003419991231200073115199912312001131162003110003719991231200212311I hope of to have been explainThank you from Maximiliano (italy)RE-Sorry for my english--Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

View 1 Replies View Related

Obtain Certificate Co Configure Ssl

Jan 25, 2007

i read from msdn that i need a certificate for me to be able to configure SSL which will allow me to replicate on my publication. it says that i can obtain a certificate from a certification authority (CA). do i have to pay for it?

there is a SelfSSL that i can dowload and use for 7 days have anyone of you tried this before?

thanks a lot:)

View 3 Replies View Related

How To Obtain SQL Server Software

Sep 26, 2007



I have license information about the SQL Server 2005 Standard Edition.

Is there any possibility for me to download the media or should I need to obtain DVD only?

Regards,

NithyaPriya

View 1 Replies View Related

How Do I Obtain The Log File For A DTSX?

Aug 16, 2006

Hi everyone,

I'm stuck with this silly thing but I haven't idea how to obtain the path for the log file specified in a SSIS package programatically.

This snippet of code works fine:

Dim pkg As New Microsoft.SqlServer.Dts.Runtime.Package

Dim app As New Microsoft.SqlServer.Dts.Runtime.Application

Dim pkgResults As DTSExecResult

pkgLocation = "C:Documents and Settings40990880Mis documentosVisual Studio 2005ProjectsProyecto de SSIS3Proyecto de SSIS3ProvaPrimera.dtsx"

pkg = app.LoadPackage(pkgLocation, Nothing)

pkgResults = pkg.Execute()



After execution I'd like to see the log file which is allocated in the same place than DTSX file. But how??

Using pkg.LogProviders.Item(0).Name appears description reference "SSIS log provider for Text files1" but no the name of the file or its path



Thanks in advance for any thought or advice,





View 6 Replies View Related

Obtain Version 7 Log File Space Used Using T-SQL

Mar 14, 2000

I need to be able to obtain the storage space used for database log files through T-SQL commands.
I can do this in version 6.5 but have been unable to accomplish this in version 7.0.
Does anyone have a suggestion?

View 2 Replies View Related

Need To Obtain Space Used On Database Log Files

Mar 10, 2000

I need to be able to obtain the storage space used for database log files.
I can do this in version 6.5 but have been unable to accomplish this in version 7.0.
Does anyone have a suggestion?

View 1 Replies View Related

Obtain Database & Transaction Log Size

Aug 3, 2001

Is there any system stored procedures or system tables/db that can tell the space use, total available, for a particular db & its transaction log ?

Thanks,
Ben

View 1 Replies View Related

Openrowset To Obtain CSV Data In SQL Server

Aug 2, 2007

I am trying to obtain data from CSV file (in Excel) to SQL Server table using Openrowset command. There is one issue I am facing – The columns which have blank values in the first 20 records and then only has a proper value in the 21st record are not getting imported correctly. For such columns, I get a NULL for the proper value as well. I need to proper value to come. Any suggestion?

Thanks in advance,

sajmera

View 2 Replies View Related

SQL 2012 :: Obtain Two Columns In A Query?

Aug 19, 2014

i want to obtain two columns in a query but i don´t know how to.ex.

col1 col2
1 A
1 B
2 A
1 C

I need something like this.

col1 col2
1 A, B, C
2 A
Col1 = Table Z
Col2 = Table Y

View 6 Replies View Related

Need One Query To Obtain Results I Can Only Get With Two Queries

Jul 23, 2005

I'm trying to devise a query for use on SQL Server 2000 that will dowhat was previously done with one query in MS Access. The MS Accessquery was like this:SELECT Count(*) as [Opened],Abs(Sum([Status] Like 'Cancel*')) As [Cancelled]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus not like 'Deleted'Group By Year(DateOpened), Month(DateOpened)Order By Year(DateOpened), Month(DateOpened)Here were I'm at with SQL Server, TSQLSelect Right(Convert(Char (11), Min(DateOpened), 106), 8) as [MonthOpened],Count(Status) as [Opened]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus not like 'Deleted'Group By Year(DateOpened), Month(DateOpened) Order ByYear(DateOpened), Month(DateOpened)Which yieldsMonthOpened======================Aug 2004503Sep 2004752Oct 2004828Nov 2004658Dec 2004533Jan 2005736Feb 2005707Mar 2005797Apr 2005412AndSelect Right(Convert(Char (11), Min(DateOpened), 106), 8) as [MonthOpened],Count(Status) as [Cancelled]FROM Detail_Dir_LocVWhere (Detail_Dir_LocV.DateOpened > '2004-8-01') andStatus like 'Cancelled%'Group By Year(DateOpened), Month(DateOpened) Order ByYear(DateOpened), Month(DateOpened)Which yields;MonthCancelled=========================Aug 200478Sep 2004105Oct 2004121Nov 2004106Dec 200475Jan 200582Feb 200571Mar 200594Apr 200533What is desired isMonthOpenedCancelled============================Aug 200450378Sep 2004752105Oct 2004828121Nov 2004658106Dec 200453375Jan 200573682Feb 200570771Mar 200579794Apr 200541233Any assistance would be appreciated.Cheers;Bill

View 3 Replies View Related

Obtain Contents Of Stored Procedures

Jul 20, 2005

Hi all,I need to be able to obtain the full contents, i.e. sql statementsinside, of all procedures in SQl Server 2000. I am using MS type 4JDBC driver. I know that from the database metadata, I could get thenames of all stored procedures and their column structures. However,I did not find any thing that will help me to obtain contents of thestored procedures. Any help would be very much appreciated. Thanks:-)) Vien Nguyen

View 1 Replies View Related

Recommended Method To Obtain SQLDataPath

Jul 20, 2005

I know the default data path on a SQL7 server is defined in theregistry key SQLDataPath. I want to be able to determine the defaultdata path in a VB.NET application on the local machine and remotemachines. Is using the Registry Class the best way to do that or isthere a SQL command that can tell me? I have read about xp_regread butI can't find it documented anywhere and I do not know what parameterlist it is expecting. I thought this path may be in an InformationSchema view, but I can't find it.Thanks for any help.

View 2 Replies View Related

Could Not Obtain A Required Interface Error

Apr 11, 2007



I have created a linked server that connects to "mpp" file, and it connects and opens successfuly returning a list of tables that exists in the linked server to the mpp file.



But the problem i am facing now that whne i write a select statment to get data from the tables in this linked server

select * from linktompp.testmpp.dbo.tasks

such that linktompp is the linked server name

testmpp is the catalog name

tasks is the table name i need to select data from

it shows an error that says

"Could not obtain a required interface from OLE DB provider 'Microsoft.Project.OleDB.11.0'."

"[OLE/DB Provider 'Microsoft.Project.OleDB.11.0' IUnknown::QueryInterface returned 0x80004002: IGetDataSource]"





could anyone tell me the reason of this error

thanks

View 1 Replies View Related

Cannot Obtain The Schema Rowset DBSCHEMA_TABLES_INFO

May 14, 2007

I see others having this problem when trying to run a query across a link from 2005 to a 2000 server. But we are already running SP4 on our 2000 server. What gives?





OLE DB provider "SQLNCLI" for linked server "s-1" returned message "Unspecified error".

OLE DB provider "SQLNCLI" for linked server "s-1" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".

Msg 7311, Level 16, State 2, Line 5

Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "s-1". The provider supports the interface, but returns a failure code when it is used.

View 2 Replies View Related

Obtain The Query Plan Of A Running Process

Sep 21, 2006

Hi,Is there a way to findout the query plan of the executing process usingthe SPID/KPID information.Thanks in advance,Thyagu.D

View 1 Replies View Related

How To Obtain Query Execution Time As A Variable?

Feb 28, 2008

Hi guys,
I am looking for system procedure or system variable that will give the execution time of a SQL query.

I need to capture the execution time of a query in a variable and depending on the value do furthur processing.

Any help in this regard will be appreciated.

View 18 Replies View Related







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