Query To Search For Reference Number That May Appear In Two Different Columns?

Mar 20, 2012

How can I run a query that searches for a reference number that may appear in two different columns? I want to pull all records for idenification numbers that can also show up in a secondary identification column.

View 4 Replies


ADVERTISEMENT

SELECT Query - Different Columns/Number Of Columns In Condition

Sep 10, 2007

I am working on a Statistical Reporting system where:


Data Repository: SQL Server 2005
Business Logic Tier: Views, User Defined Functions, Stored Procedures
Data Access Tier: Stored Procedures
Presentation Tier: Reporting ServicesThe end user will be able to slice & dice the data for the report by


different organizational hierarchies
different number of layers within a hierarchy
select a organization or select All of the organizations with the organizational hierarchy
combinations of selection criteria, where this selection criteria is independent of each other, and also differeBelow is an example of 2 Organizational Hierarchies:
Hierarchy 1


Country -> Work Group -> Project Team (Project Team within Work Group within Country)
Hierarchy 2


Client -> Contract -> Project (Project within Contract within Client)Based on 2 different Hierarchies from above - here are a couple of use cases:


Country = "USA", Work Group = "Network Infrastructure", Project Team = all teams
Country = "USA", Work Group = all work groups

Client = "Client A", Contract = "2007-2008 Maint", Project = "Accounts Payable Maintenance"
Client = "Client A", Contract = "2007-2008 Maint", Project = all
Client = "Client A", Contract = allI am totally stuck on:


How to implement the data interface (Stored Procs) to the Reports
Implement the business logic to handle the different hierarchies & different number of levelsI did get help earlier in this forum for how to handle a parameter having a specific value or NULL value (to select "all")
(WorkGroup = @argWorkGroup OR @argWorkGrop is NULL)

Any Ideas? Should I be doing this in SQL Statements or should I be looking to use Analysis Services.

Thanks for all your help!

View 1 Replies View Related

Return Number Of Columns - Pivot Query Into Report Builder

Oct 31, 2014

I have a query which returns number of columns using pivot ( rows into columns -- dynamic sql pivot columns). Since it is dynamic pivot, how can I bind this returned values into report builder matrix reports.

Look at this example :

First time query returns
StudentId | Col1 | Col2 | Col3

Second time query returns
StudentId | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 ...

How to bind this query into report builder 3.0 reports?

View 13 Replies View Related

How To Enter More Number Of Rows In A Table Having More Number Of Columns At A Time

Sep 24, 2007

Hi

I want to enter rows into a table having more number of columns

For example : I have one employee table having columns (name ,address,salary etc )
then, how can i enter 100 employees data at a time ?

Suppose i am having my data in .txt file (or ) in .xls

( SQL Server 2005)

View 1 Replies View Related

SQL Search :: Query For Finding Two Columns Data In Third Column And Getting Data From It?

Jul 6, 2015

getting result as given below.

Input:

id Name Data

101 AA PQ102BBRAJAKIRANBUBLU

102 BB RS101AAEROJUCHALABAGUNDI

103 CC TU104GGANDICANKILLANYONE

OUTPUT:

id Name Data

101 AA 101AAEROJUCHALABAGUNDI

102 BB PQ102BBRAJAKIRANBUBLU

103 CC

View 4 Replies View Related

Limitations In Term Of Number Of Tasks And Number Of Columns

Jun 5, 2007

Hi,

I am currently designing a SSIS package to integrate data into a data warehouse fact table. This fact table has about 70 columns among which 17 are foreign keys for dimension tables.

To insert data in that table, I have to make several transformations and lookups. Given the fact that the lookups I have to make are a little complicated, I have about 70 tasks in my Data Flow.
I know it's a lot, but I can't find a way to make it simpler. It seems I really need all these tasks.

Now, the problem is that every new action I try to make on the package takes a lot of time. At design time, everything is very slow. My processor is eavily loaded each time I change a single setting in one of the tasks, and executing the package in debug mode takes for ages. If I take a look at the size of my package file on disk, it's more than 3MB.

Hence my question : Are there any limitations in terms of number of columns or number of tasks that can be processed within a Data Flow ?

If not, then do you have any idea why it's so slow ?

Thanks in advance for any answer.

View 1 Replies View Related

How Can Your Reference Columns In A System Stored Procedure

Nov 5, 2002

I want to have a Stored procedure call another stored procedure gathering the info from some of the information SP#1 and use it calling SP#2...
For example sp_Help returns columns when executed (Name, Owner, Object_type).
So how can I reference the Name column and pass it to SP#2

Exec sp_Help

...?
SP#2 name=sp_help.Name ???


Thanks


Richard

View 1 Replies View Related

Output Columns In Script Shape -- Object Reference NOT Set

May 12, 2006



Hi there,



I'm getting an error in ascript transform shape.



When I try to write a value to an output column I'm getting an error saying the object reference cannot be set.



So my code looks like this - Row.OutputColumn = True

Any ideas??

View 1 Replies View Related

Help W/ Stored Procedure? - Full-text Search: Search Query Of Normalized Data

Mar 29, 2008

 Hi -  I'm short of SQL experience and hacking my way through creating a simple search feature for a personal project. I would be very grateful if anyone could help me out with writing a stored procedure. Problem: I have two tables with three columns indexed for full-text search. So far I have been able to successfully execute the following query returning matching row ids:  dbo.Search_Articles        @searchText varchar(150)        AS    SELECT ArticleID     FROM articles    WHERE CONTAINS(Description, @searchText) OR CONTAINS(Title, @searchText)    UNION    SELECT ArticleID     FROM article_pages    WHERE CONTAINS(Text, @searchText);        RETURN This returns the ArticleID for any articles or article_pages records where there is a text match. I ultimately need the stored procedure to return all columns from the articles table for matches and not just the StoryID. Seems like maybe I should try using some kind of JOIN on the result of the UNION above and the articles table? But I have so far been unable to figure out how to do this as I can't seem to declare a name for the result table of the UNION above. Perhaps there is another more eloquent solution? Thanks! Peter 

View 3 Replies View Related

VB 2005 Express: Unable To Reference Parent And Child Columns Of A DataRelation

Dec 17, 2007

From material I have read I should be able to reference columns in a datarelation by

Parent.ColumnName
Child.ColumnName


The code below is Ok until I use the Child reference

Dim tbl0102reltn As New DataRelation("tbl012tbl02", tbl01Cols, tbl02Cols)

dataset01.Relations.Add(tbl012tbl02reltn)


'=== Add the new Forecast Column to table01 (The display table)
Dim FcstTotVol As DataColumn = New DataColumn("FcstTotVol")
'declaring a column named Name
FcstTotVol.DataType = System.Type.GetType("System.Int16")
FcstTotVol.Expression = "Child(tbl012tbl02reltn).TotVol"

The last line throws an error

"cannot interpret token Child() at position 1"

If I replace the last Line as

FcstTotVol.Expression = "tbl0102reltn.Childtable.Columns(10)"
i receive the error

"The expression contains undefined function call tbl0102reltn.Childtable.Columns()."

I am unable to find away to feed the expression required for the new column.

Can anyone assit.


Thanks, Jim

View 1 Replies View Related

Search For Records That Begins With A Number (0-9)?

Aug 2, 2007

Hi all,For now I can use this code to display all the records that begins with a Letter:(WHERE SONG_TITLE LIKE @SONG_TITLE + '%') Now how do I search for records that begins with a number (from 0-9), as an add-on to the above query?Thank you very much,Kenny. 

View 6 Replies View Related

Single Number Search Problem

Apr 10, 2008

Hi All,

Table structure is Column1 - Column2 - column3 - column4.
E.g. 0-134-00-99, thus the number is 013400 to 013499.
consider the following scenario:
0-1803-0000-9999.
User enters a number as 018030015* --> * means any number starting with this and contained in the range. Hence the above range should be returned. i.e. (0-1803-0000-9999). The issue is to do this search, i will have to check all 1000 NUMBERS because using 'LIKE' will only search for all numbers starting with 018030015.
(SELECT * FROM table1 WHERE Column1+Column2+Column3 LIKE '018030015%') this query won't return the row 0-1803-0000-9999
If i write a cursor to check for 1000 such numbers, i can get the result, but is there a better solution?

View 19 Replies View Related

Using Variable Number Of Search Strings With VBA

Mar 5, 2015

I have created a kind of search function in my Excel sheet where the user can select multiple items from different listboxes.

To save the items I use an array. So in one case only 1 items off the array is filled, but another time maybe 3 items are filled in the array.

I use the array to search in a SQL database (this is string rva(i) in the code). But when the array is empty it results in an error.

This is what I have so far. (the rule at the bottom won't work also )

rc.Open "SELECT [Datum],[RvA_Nr], [RvA_Letter], [Afdeling], [EVAL], [Matrix], [Component], [AS3000], [AP04], [Rec] FROM dbo.QHSE_2ndline_history " _
& "WHERE [Afdeling] = '" & afd & "' AND [Datum] >= '" & datum1 & "' AND [Datum] <= '" & datum2 & "' AND " _
& "CASE WHEN '" & rva(1) & "' <> '' then [RvA_Nr] = '" & rva(1) & "' END AND" _
& "([Matrix] LIKE '%" & matrix(1) & "%' OR [Matrix] LIKE '%" & matrix(2) & "%' OR [Matrix] LIKE '%" & matrix(3) & "%' OR

[Code] .....

View 1 Replies View Related

Arabic Text And Number Search

Nov 6, 2007

Hi Team Members,

I am planning to develop application using VB.NET and MS SQL Server Express.

Complete application (Forms and Reports) will be in Arabic,
1. Can I use SQL Server Express for this senario
2. Can I perform search in Arabic (Numeric and Text)
3. Can I take back up of Database
4. Just to make sure, can I have Stored Procedures, Views and security features in SQL Server Express


Regards,
Mustaq

View 1 Replies View Related

Search On Error Number Returns Nothing: 0x016F9EA4

Jun 22, 2007

I googled on the latter error number and got nothing back
Error: 0xC0048006 at Set Destination File, ActiveX Script Task: Retrieving the file name for a component failed with error code 0x016F9EA4.

The former only returns one result which does not explain my problem

View 4 Replies View Related

Search Columns

Jan 31, 2008

Hi everyone
I am trying to create a stored procedure that will searches any of the following different columns of the defferent tables

[dbo].[Store]
[dbo].[StoreType]
[dbo].[City]
[dbo].[Province]



--I joined the 4 tables below

SELECT dbo.Store.Store, dbo.Province.Province, dbo.City.City, dbo.StoreType.StoreType
FROM Store INNER JOIN
dbo.Province ON dbo.Store.ProvinceID = dbo.Province.ProvinceId INNER JOIN
dbo.City ON dbo.Store.CityID = dbo.City.CityId INNER JOIN
dbo.StoreType ON dbo.Store.StoreTypeID = dbo.StoreType.StoreTypeId Where 1 = 1

--I have 2 parameters
1.@varSearch varchar(50)
2.@varProvince varchar(50)

in @varSearch parameter You can search any thing from [dbo].[Store].Store or [dbo].[StoreType].StoreType or [dbo].[City].City
and @varProvince will be [dbo].[Province].Province

the output must show every Store,StoreType or City in the province

View 6 Replies View Related

SEARCH ALL COLUMNS

Sep 26, 2007

Hi,


How to search for a value across all columns in table in Tsql or in SSIS


Cheers

View 1 Replies View Related

Stored Procedure - Variable Number Of Parameters For Search

Dec 4, 2003

Hi,
I have a repeater control which I populate with search results from SQL Server.

But I can't figure out how to cope with users who submit multiple search items and still use my stored procedure. Is this possible or do you have to build the query with a StringBuilder and execute it manually?

I'm using a stored procedure with parameters:

input parameters <-- PageSize & CurrentPage
output parameter --> TotalRecords

Am using a temporary table to store all records before Select-ing those required for the particular page.

If I compose the query manually then I can't figure out how to get TotalRecords back as a return parameter. Would appreciate help on this one.

Am hoping that stored procedures can cope with an unknown number of parameters.

View 3 Replies View Related

Search Tables And Get Columns

Nov 10, 2005

I drew short straw on some reports work and am spending an eternity searching through catalogs looking for tables and columns. I'm a little new to SQL. Is there a way to search a catalog for table column names?

View 2 Replies View Related

Search All Columns Of All Tables

Feb 5, 2008

How to search all columns of all tables for a keyword?:o
that in MS sql

thanks in advance..

View 2 Replies View Related

Search Multiple Columns

May 16, 2008

Hi

I have a table with 9 fields that I need to check. I want to check if "text1" and "text2" is in any of thoose 9 fields. But I dont want to check the combination of "text1" and "text2" in the same column. I want for example be able to check if "text1" is in column 1 to 9 and if "text2" is in column 1 to 9. Can someone give me a suggestion on how to do this?

View 6 Replies View Related

How To Search All Columns In A Table At Once?

Dec 13, 2005

This is a true newbie question. I want to search an entire table for a string. Is there a way to do the equivalent of:

View 5 Replies View Related

Search For Blank Columns

Sep 26, 2007

Hi ,

If asked to find all the columns across tables which contains any NULL or blank value then what could be the best approach ?

I am sure there must be a way other than checking each column of each table .

Can anyone help me out in this .

Cheers

View 6 Replies View Related

Multiple Columns In In Search

May 30, 2006



Is it possible to put a set of columns into a select statement using "in"

For example:

select count(*) from table1 where (col1, col2, col3, col4) in (select a.col1, a.col2, a.col3, a.col4 from table1 a where........)



This is possible in this form for Oracle and DB2 but I cannot get it to work in Sql Server.

Any ideas?

View 7 Replies View Related

Does Full-text Search Could Count Words Occurrence Number

May 15, 2008

Hello,
I use the full-text search utility in SQL Server 2005 to find word in PDFs document.
This is my 'Documents' table:
id (PK), data (VarBinary(max)), extension (nvarchar(4))
My full-text catalog on 'data' column works fine because when I search 'Microsoft', my document containing this word is returned as result.

SELECT * FROM Documents WHERE freetext([data], 'Microsoft');
1 | 0x255044.... | .pdf

But I need to know how many times 'Microsoft' word appears in this document.
Do you have any idea how can I retrieve this information?
Thanks in advance!

View 1 Replies View Related

T-SQL (SS2K8) :: Search For A String In Expression By Number Of Its Appearance - Charindex

Apr 3, 2015

I have written a query to search for a string in an expression by the number of it's appearance. Script is like this:

DECLARE @Expression VARCHAR(8000) = 'abcd_e_fgh',
@SearchString VARCHAR(10)= '_',
@OccuranceNumber SMALLINT = 1
DECLARE @SearchIndex INT = 0, @SearchIndexPrevious INT = 0, @Sno INT = 0
WHILE @Sno < @OccuranceNumber BEGIN

[Code] .....

Here i'm trying to search "_" in expression "abcd_e_fgh" where it is appearing for first time. it gives me 5 correctly. Now when i change the @OccurenceNumber to 2 or 3, it gives correct values 7 and -1 respectively. However now when i change it to 4, it gives me 5. So when it's trying to check for fifth appearance of "_", it's not actually giving 0 or -1 but repeating the value 5.

View 9 Replies View Related

Search And Results Using Multiple Columns

Feb 10, 2004

I have a DBTable named Vendors which includes the following columns: CompanyName (Name Here)
SBI (Yes, No)
MBE (Yes, No)
SBI (Yes, No)
WBE (Yes, No)

I'm trying to do a search on Vendors where either SBI or MBE or SBI or WBE is equal to 'yes' and then order by company name.

I'm lost on both the search and the results code.

I'd like to have a drop down for the search like this:

<form name="Search" action="vendor_results.asp" method="post">
<Input type=hidden name="validate" value=1>

Show all Vendors who are: <Select name="?????">
<OPTION value="YES">SBI
<OPTION value="YES">SBE
<OPTION value="Yes">MBE
<OPTION value="Yes">WBE
</select>
<Input type="submit" Value="Go">
</form>


Any ideas on how to make this work would be greatly appreciated.

View 3 Replies View Related

Search Multiple Columns With REGEXP

Jul 20, 2005

********************alt.php.sql,compdatabases.ms-sqlservermicrosoft.public.sqlserver.programming***********************************Why doesn't this work:SELECT *FROM 'Events'WHERE dayofweekREGEXP 'monday' OR description REGEXP 'monday'When this does work:SELECT *FROM `Events`WHERE dayofweekREGEXP 'monday'

View 6 Replies View Related

T-SQL (SS2K8) :: Full-Text Search Over XML Columns

Jun 5, 2014

Are the XML tags searched, as well as, the contents within the tags, when an xml column is included in a full-text index? Or is it only the contents within the tags? Would I need to combine full-text search with XPath/XQuery to get at the actual tags?

View 0 Replies View Related

SQL Search :: How To Find What Are All Columns Used In A Store Procedure

Nov 23, 2015

I would like to know all the columns used in a store procedures.I have used dynamic sql to create these procedures .

View 4 Replies View Related

Max. Number Of Columns

May 21, 2007

does anyone know what the maximum number of columns is that an SQL table can contain ?

i seem to remember that in the past it was something like 200 columns max, but i don't know whether that has changed with newer versions of SQL Server

looking at the spec for SQL Server 2000 i see a maximum of 1024 columns per base table - am i right in interpreting this to mean the maximum is now 1024 columns or is a base table different from an SQL table ?

View 2 Replies View Related

Full-Text Search On Multiple Tables && Columns

Sep 19, 2007

Hi,
I have tried this code from http://jtkane.spaces.live.com/Blog/cns!1pWDBCiDX1uvH5ATJmNCVLPQ!316.entry for full-text search on multiple tables & columns.
Here's my code:
SELECT * from [tStaffDir] AS e, [tStaffDir_PrevEmp] t,CONTAINSTABLE([tStaffDir], *, @Name) as AwhereA.[KEY] = e.[ID] andt.[ID] = e.[ID]
I have FT the both the tables above and I am able to get results from the  [tStaffDir] table but not the [tStaffDir_PrevEmp] table.The [tStaffDir_PrevEmp] table does have a column (which is [ID]) that is indexed, unique and non-Nullable.Please advise what I should do and look out for.
Many Thanks.

View 2 Replies View Related

Transact SQL :: Search Functionality With Multiple Columns - Writing SP

Jul 20, 2015

What is the most efficient way to write an SP to tackle all kinds of combinations here (where a user could give any search input).I know this must be fairly common to come across this situation.I have written an SP which will take in all the parameters and based on "IF" statements and using "LIKE" in SQL, this SP returns search results.But I wanted to know if there was more efficient ways of doing this, as you can imagine you might end up having several combinations of IF conditions.

View 9 Replies View Related







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