What Is The Good, Bad, And The Ugly Methods For Searching Lists?

Apr 25, 2008

I once had a DBA tell me the ancient wisdom of the different ways of searching through lists and the performance impact of each type. Does anyone know this secret?

I think the best performance was SELECT * FROM temp WHERE temp.acctid IN (1123,1234,1235)

The worst performance I think would have been correlated subqueries. Then I can't remember where temp tables and embedded queries ranked.

Thanks

View 1 Replies


ADVERTISEMENT

SQL 2000 (SP 1) - The Good, The Bad, The Ugly...

Jul 27, 2001

All -

I was wondering if anyone has any SP1 horror stories (or success stories) to report, I haven't installed the SP yet, but was hoping to find constructive feedback from those who have...

Regards,
Tom

View 1 Replies View Related

Good Searching

Jan 7, 2008

 hello all..i have make a searching, but is not good. my code like that:Public Class getall Public Function getitem(ByVal id As String) As DataSet        Dim con As SqlConnection = New SqlConnection("Data Source=BOYsqlexpress;Initial Catalog=GAMES;User ID=ha;Password=a")        Dim ds As New DataSet()          Dim adapter As New SqlDataAdapter("select * from [item] where name like '%" & id & "%'", con)        Try            con.Open()            adapter.Fill(ds, "user")            Return ds        Catch ex As Exception            Console.Write(ex.Message)        Finally            con.Close()            con = Nothing        End Try        ' Next        Return ds    End Functionand class  my item in database is containning  dragon ball 3, counter strikeif i insert dragon, it can display dragon ball 3.but if i insert dragon 3, it not display dragon ball 3.it should display dragon ball 3 .how should i change my code?thx... 

View 1 Replies View Related

An Ugly Self-join (oh, That Doesn't Work!!)

Feb 17, 2004

Hi again, all...here I am again, trying to work on my CloseIndex thang again...Same subject, different tack...

Basically, I have two tables...for the sake of simplicity, let me define them as:


PortfolioIndex
PortfolioID int
CreateDate smalldatetime
CloseIndex float

PortfolioPerformance
PortfolioID int
CreateDate smalldatetime
PrevDate smalldatetime
DailyPerChg float

UPDATE PortfolioIndex
SET CloseIndex = CASE
WHEN PPI.CloseIndex IS NULL THEN 100.00
ELSE (PPI.CloseIndex + (PPI.CloseIndex * PP.DailyPerChg / 100))
END
FROM PortfolioIndex AS P INNER JOIN PortfolioIndex AS PPI on (P.PortfolioID = PPI.PortfolioID), PortfolioPerformance AS PP
WHERE (P.PortfolioID = PP.PortfolioID) AND
((P.CreateDate = PP.CreateDate) AND
(P.CreateDate = @CreateDate) AND
(PPI.CreateDate = PP.PrevDate))


What I am trying to do is...get the previous day's portfolioIndex row's CloseIndex and create a new one for today's row.

As ugly as it is, it works when I execute it in the SQL Query Analyzer, but when I try to create the stored procedure, the syntax check complains that the PortfolioIndex reference at the UPDATE... part is AMBIGUOUS...yet when I define it in the SP as P.PortfolioIndex, it fails at run time saying there is no object named P.PortfolioIndex (well, of course there isn't!).

How can I make this work (and if possible, make it prettier too! *L* ;) )

View 7 Replies View Related

Drop Down Lists

May 27, 2004

I'm want to be able to choose(including multiple selections) names from a drop down list that are fetched from the database(from table "Employees") and add them to table "Biotechnology".

Employees(ID,FirstName,LastName)
Biotechnology(ID,EmployeeID)

**assuming that EmployeeID in "Biotechnology" is the ID from "Employees" table

Example: We add Employees.ID(23, 33) to Biotechnology.EmployeeID

would be

Biotechnology:
[ID] [EmployeeID]
01 - 23
02 - 33

View 1 Replies View Related

Mailing Lists

Jul 20, 2005

Hi AllWe are running SQL Server & Outlook with an exchange server. We arelooking for a way to import the address book & email details into adatabase table.We have managed to do this with MS Access by using the import optionexchange(). Is there a similar way this can be done in SQLServer 2000

View 2 Replies View Related

Working With Lists

Aug 16, 2007

I'm new to SQL. I don't understand yet how to add if statements and other scripting techniques. But this is what I am trying to do...

I have a list of IDs (1, 2, 3, 4, 5, 6, 7, 8). I want to query a table and then display which of those IDs are NOT in that table. It seems like it should be easy, but I don't know how to do it.

Any help would be much appreciated.

thanks

scott

View 1 Replies View Related

T_SQL, Lists And Arrays

Dec 30, 1999

I want to pass my stored proc a list, and either loop through it as a list or (better) turn it into an array and loop through it that way to insert it. Psuedocode would be...

Loop from 0 to ListLength
begin
INSERT Transaction_Data
end

Thanks from an SQLS7 newbie,

jE

View 4 Replies View Related

SP That Lists The Servers Online

May 3, 2001

Does anyone know which SP to use to get the list of available servers?
I want to call it from a VB app via ADO to provide the user with a choice of servers available.

View 1 Replies View Related

Arrays And Lists In SQL 2005

Mar 4, 2007

I am glad to announce that there is now a version of my article "Arrays andLists in SQL Server" for SQL 2005 available on my web site.THe URL for the article ishttp://www.sommarskog.se/arrays-in-sql-2005.html. If you are curious aboutthe performance numbers they are in an appendix athttp://www.sommarskog.se/arrays-in-sql-perftest.html.The old version of the aritlce remains, as the new article covers SQL 2005only. The old version is now athttp://www.sommarskog.se/arrays-in-sql-2000.html.The old URL, http://www.sommarskog.se/arrays-in-sql.html leads to a pagethat links to both articles.And the reason that there are two articles is simply that SQL 2005 addsso many new features: nvarchar(MAX), the CLR, the xml data type, CTE thatall can be used in the realm of arrays and lists.--Erland Sommarskog, SQL Server MVP, Join Bytes!Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/pr...oads/books.mspxBooks Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodin...ions/books.mspx

View 1 Replies View Related

Variable Arg Lists To PreparedStatements

Jul 20, 2005

Is there a way to use PreparedStatements (or bind variables) with SQLstatements that have a variable number of arguments. For example, Ihave an array of IDs for employees of a certain type and I want tohave a PreparedStatement retrieve all of them in a single SQL call.SELECT FROM employees WHERE employee_type = ? employee_id in(?,?,?,...,?)It seems at least in Java that PreparedStatements can only take afixed number of arguments?PreparedStatement pstmt = con.prepareStatement("SELECT FROMemployees WHERE employee_type = ? AND employee_id = ?");pstmt.setLong(1, employeeType);pstmt.setInt(2, employeeID);Is there a way to have a PreparedStatement for a SQL "IN" clause orsimilar variable argument length clauses? I heard that Temp tables isone option where you first insert your array of IDs into a Temp tableand then use a JOIN. But that seems to defeat the purpose as itrequires multiple queries. Is there anyway to something like this:int[] employeeIDArray = getEmployees();PreparedStatement pstmt = con.prepareStatement("SELECT FROMemployees WHERE employee_type = ? AND employee_id IN (?)");pstmt.setLong(1, employeeType);pstmt.setIntArray(2, employeeIDArray); <--- How can I do this?Thanks,- Robert

View 7 Replies View Related

Getting Data From Sharepoint Lists

May 15, 2006

Hi,

I'm trying to get data from WSS lists by web services. I think there are two ways:

- using SSIS standard components (Web Service Task) and
- creating a custom source adapter.

My problem with the Web Service Task is, that the WSS method GetListItems has some non-standard parameters (see part from wsdl-file below). Thus, after selecting the method in the editor an clicking on "Ok", I get the error message "The selected Web method contains unsupported arguments". I think the problem is the missing type-attribute.

<s:element name="GetListItems">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="listName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="viewName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="query">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
...

My question: Is there a way to extend the Task to handle such parameters?

View 1 Replies View Related

SSIS &&amp; SharePoint Lists

Apr 7, 2006

Hi,



is there any example how to extract values from a SharePoint list? I searched in Google but I only found something about that someone failed using the web service task for it... If possible I would like to get around any custom .net code (Scripts would be OK), but if I can't get around that, I have to follow that path...

Thanks,



View 5 Replies View Related

No _vti_bin Or Lists.asmx

Apr 28, 2008

I am desperate to retrieve lists from SharePoint using Reporting Services to consolidate with other data


I got stopped before I ever started. Defined a data source using the following syntax....but then I search for vti_bin or lista.asmx if find none.

http://<server>/<path>/_vti_bin/lists.asmx.

sharepoint/SQL 2005 running in intergated mode on single machine for proof of concept.

after formulating the dataset query I receive an error that
the XmlDP query is invalid.(Microsoft.ReportingServices.DataExtensions)

Any ideas how I screwed things up?

.

View 2 Replies View Related

DbDataReader.NextResult With Generic Lists ?

Jun 20, 2006

 Hey I'm using this DAL to populate a generic list called assetDetailListHowever I'm adding a 2nd result set to my stored proc, protected void GenerateAssetDetails<T>(DbDataReader dataReader, ref List<AssetDetails> assetDetailList)        {            while (dataReader.Read())            {                    // Create a new culture                    AssetDetails assetDetail = new AssetDetails();                    // Set the culture properties                                       assetDetail.FileName = dataReader.GetString(dataReader.GetOrdinal("filename"));                    assetDetail.Title = dataReader.GetString(dataReader.GetOrdinal("title"));                    assetDetail.AltTag = dataReader.GetString(dataReader.GetOrdinal("alt_tag"));                    assetDetailList.Add(assetDetail);                    dataReader.NextResult();// this is the 2nd result set               AssetContent assetContent = new AssetContent();               assetContent.content_id = dataReader.GetInt32(dataReader.GetOrdinal("content_id"));             how do I creatre another  list .Add(assetContent);            }            // Close and dispose of the reader            dataReader.Close();            dataReader.Dispose();        }        #endregion    }

View 2 Replies View Related

Any Tips For Using Large Parameter Lists

Mar 8, 2007

Our parts table has 5k records. I want to use part number as a parameter for one of my reports. Is there a way to do this and have the report generate in a reasonable amount of time?

Thanks

View 3 Replies View Related

Horizontal Display For Tables Or Lists?

Jul 5, 2007

I would like to display a couple of records horizontally via a table or list, but don't think this is possible. Am I right? The given recordset should only have two records and the formatting would be much better if they were displayed left to right rather than one on top of the other. Is this just not possible with SSRS? Thanks,

Levi

View 2 Replies View Related

Aggregate Data Grouped Lists

Apr 15, 2008

Hello,

I`ve created a table in a list that is grouped by years. Result is a Report, that consists of several years (List grouped by years, each containing the table with the data of the year).

Now I want to aggregate some numbers of the table on each page (year) of the list.

The sum()-function - doesn't matter which scpoe I use - always aggregates only the values of the actual list (Year), not considering the years before.

Can anyone help?

Thanks a lot -

Markus

View 2 Replies View Related

Management Studio Lists All Databases

Oct 18, 2005

I was under the impression that Management Studio wouldn't list any databases that a user doesn't have access to.  But if I create a new user and give them db_owner permissions to just one database, if they log into Management Studio, they are able to see all databases listed.  They don't have access to do anything further, but they can still see the list which I thought was handled better in 2005.

View 8 Replies View Related

Lists: Can't Get A Header To Appear For Each Page Of My List

Apr 16, 2008



I want to display a phone directory by department.

I created a list and told it to group on department and then I put a table in the list that had PhoneNo, EmployeeName as the columns.

Now the list works in that it seperates that table out by department (so 5 departments means 5 instances of the table with a text box above the table but inside the list with DepartmentName.Value).

The problem though is that text box only appears once for each table, the first time the table is generated. I can't get the department name to display at the start of each page.

Do I need another sublist or something, how can I get the department name textbox to appear at the start of each page for my list?

So what I have is:
DEPARTMENT NAME: Sales
---(table starts here)
.............5555...Smith
.............lots more names.......
- - - - - - - - - - - - - - - PAGE BREAK - - - - - - - - - -
---(table continues on from last page...)
.............4444...Johnson
.............3246...Benson
---(table ends here)
------------------------------------new iteration of this, so the next department is IT and this all repeats again

What I want to get is:

DEPARTMENT NAME: Sales
---(table starts here)
.............5555...Smith
.............lots more names.......
- - - - - - - - - - - - - - - PAGE BREAK - - - - - - - - - -
DEPARTMENT NAME: Sales (this is repeated as it is the start of a new page, in a perfect world I'd be able to even say "Continued..." after the department name on all pages that were not the first page it appeared)
---(table continues on from last page...)
.............4444...Johnson
.............3246...Benson
---(table ends here)
------------------------------------new iteration of this, so the next department is IT and this all repeats again with department name at the start of each and every page

View 1 Replies View Related

Headers On New Pages Using Lists And Subreports

Sep 22, 2005

I have a large report which profiles a customer and produces many pages consisting of sales records, support calls and emails, etc etc.

View 3 Replies View Related

WSS 3.0 Lists Data Processing Extension

Mar 12, 2007

Hello,



I'm writing a Data Processing Extension for SSRS 2005 that allows you to use a WSS 3.0 List as a dataset.
This works for one list per dataset. Now I am trying to extend the extension to allow multiple lists in a dataset because I want to join lists on a common field (INNER JOIN). The problem is that I can only return one DataTable to the Report Server with the DataReader. Does anyone know if it is possible to return multiple DataTables (without the join)?

I'm a student, working on this project. I know Visual Basic.net but only started last month with Data.

Thanks in advance

Tom

View 2 Replies View Related

SQL Connection Methods

Jun 5, 2007

Set myConn1 = Server.CreateObject("ADODB.Connection")
 Set myRs1 = Server.CreateObject("ADODB.Recordset")
 
Can anybody tell me what the ADODB in these two statements is telling me?

View 3 Replies View Related

UDT For Division Methods

Sep 4, 2007

Hi,

I plan to implement UDT for division methods.


The following fragment TSQL with zero check:


DECLARE @a int, @b int


SELECT



CASE WHEN @b = 0 THEN NULL

ELSE @a / @b
END



Clr UDT may look like this and script will be shorter.


DECLARE @a int, @b int


SELECT @a Type :: divide(@b)







Is that better to use UDT ?

Anyone have try this before?

View 8 Replies View Related

Methods Within An Assembly

Apr 4, 2007

Is there a way to retrieve the methods within an assembly that are attributed with SqlTrigger or SqlProcedure using T-SQL?

View 1 Replies View Related

Replication Methods

Aug 31, 2007

Hi,

I'm a newbee to replication and wanted to know about the whole mechanism of replication and how is two way replication implemnted on 2 diffrent servers located at 2 different remote locations????

View 2 Replies View Related

How To Form SQL Select Queries Using Drop Down Lists??

Nov 8, 2006

Hi
 Will somebody please explain how  to combine asp.net dropdown lists to write
a  SQL database select query. I am using VWdeveloper and C Sharp.
For example, say I have  3 dropdownlists on my  webpage  as below,
List 1, Cities, London, Rome,  Barcelona etc
List 2, Restaurants by  Type, Italian, chinese, Indian etc
List 3, Number of tables/ seats 10-20,  20- 40, 50  -100
I want someone to be able to  search for a restaurant by selecting  an  item from  each dropdownlist
such as, "Barcelona" "Italian" "50-100"
This search query would return all the Italian restaurants in Barcelona with  50-100  tables/seats.
I  would also like the select query to work even if one of the dropdownlists items  is not selected.
Hope  somebody can clear this up?
Also would sql injection attacks be a threat by doing it this way?
Thanks all
 
 
 

View 9 Replies View Related

How To Use Comma Separated Lists With Parameters In Sqldatasource?

Feb 24, 2007

I'm new (very new) to asp.net and now at 3am after maybe 12 straight hours of trying to go through examples and understand the syntax, I have a somewhat working program... basically a query parameters screen that upon a click generates a report.  The query parameter screen basically is a HTML form with a procedure that puts the field values into session variables.  The report uses <asp:sessionparameters> in the sqldatasource to apply aforementioned session variables to filter the SELECT statement's results.  They are then displayed using the gridview control.  It actually works!
Now I'm trying to figure out: if I need/want my users to be able to enter comma-separated list of values into the HTML form field and somehow get these into the SELECT statement's WHERE clause, is there a way to do this?  I'm not very experienced with asp nor sql server and have been struggling with this new challenge.  I really could use pointers as to whether there's an easy way to handle this.  In other languages in the past I would have had to parse the comma-separated list and use those to construct my SELECT statement programmatically.  I get the impression that with all this ASP.NET fanciness, there has to be a better way?
 If it matters, I'm using ASP.NET 2.0 with SQL Server 2005 Express and Visual Studio Web 2005 Express. 
 Thanks in advance for any replies, they would be GREATLY appreciated :)

View 1 Replies View Related

Updating Grid View That Has Dropdown Lists

Jun 28, 2007

I have gridview bound with SqlDataSource control. One of the grid columns is a dropdown list which is populated programatically, (the gridview has template column with edittemplate field with dropdown list), dropdown Value contains of course collection of IDs.Please tell me how to declare UpdateCommand which will update the row with the dropdown list. The problem is with parameter regarding the column with dropdown list. When i declare this parameter and bind it to SelectedValue property of the dropdownlist from edittemplate tag - it doesnt work, because datasource control cannot see this dropdown list. So, how am i supposed to declare the ID of the row being updated in <updateParameters>? Thanks in advance!  

View 4 Replies View Related

Joining Two Dropdown Lists To Create Third Dropdownlist

Oct 23, 2007

How do i add two values of Dropdownlist 1 and 2 to create No.3
Is there an easy way through Visual Studio to do this than Realms of code that i have been reading online,
 Surely, there is some command that is like Select Distinct Name from Clients WHERE city=@city + country=@country
 Or is it not this easy?

View 2 Replies View Related

Use DTS Send Auto Email To Distribution Lists

Jul 23, 2004

Hi,
I wrote the following function in an ActiveX script task in the database transformation. When I sent it to my own email address, it sent out the message fine, but when I change it to "SP Directors" which is a distribution list, and execute this step, it gave the error stated: "ActiveX Scripting encountered a Run Time Error during the execution of the script." Any one can help me on this problem, thank you so much in advance.


Function Main()
dim eMailString
eMailString = "xxxxxxxxx test"
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Test " & Time()
objMessage.Sender = "js@comcast.com"
objMessage.To = "SP Directors"
objMessage.TextBody = eMailString
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.iparty.com"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

Main = DTSTaskExecResult_Success
End Function

View 1 Replies View Related

SQL Server 2012 :: Normalizing A Column Containing Lists

Aug 20, 2015

CREATE TABLE CATEGORIES(CATEGORYID VARCHAR(10), CATEGORYLIST VARCHAR(200))

INSERT INTO CATEGORIES(CATEGORYID, CATEGORYLIST) VALUES('1000', 'S01:S03, S09:S20, S22:S24')
INSERT INTO CATEGORIES(CATEGORYID, CATEGORYLIST) VALUES('1001', 'S11:S12')
INSERT INTO CATEGORIES(CATEGORYID, CATEGORYLIST) VALUES('1002', 'S30:S32, S34:S35, S60')
INSERT INTO CATEGORIES(CATEGORYID, CATEGORYLIST) VALUES('1003', 'S40')

The CATEGORYLIST strings are composed of value ranges separated by a colon (:) and multiple value ranges separated by a comma.

The results I need are:

CATEGORYID STARTRANGE ENDRANGE
1000 S01 S03
1000 S09 S20
1000 S22 S24
1001 S11 S12
1002 S30 S32
1002 S34 S35
1002 S60 S60
1003 S40 S40

I have tried taking the original data and parsing it out as an XML file. Is there a less cumbersome way to do this in TSQL?

View 1 Replies View Related

How To Write Aggregate Functions For Tables And Lists

Apr 25, 2008

How to write Aggregate functions for tables and lists as If I can write them many problems in my reports will be solved. I tried writng it in the filters but I got an error saying Aggregate functions are not allowed for tables and lists. Can any one help me in this regard?????

View 4 Replies View Related







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