Traditional Join / Connect 6 Entities

Apr 13, 2014

I have to connect 6 entities. I am getting NO RESULT (no output)!!!

BEGIN TRANSACTION;
DROP TABLE TOPIC;
DROP TABLE LECTURE;
DROP TABLE PRICE;
DROP TABLE COURSE;
DROP TABLE PUPIL;
DROP TABLE LP;

[Code] ....

View 1 Replies


ADVERTISEMENT

LookUp Entities And Roles Against Multiple Entities?

Sep 10, 2007



Apologies if this has already been asked and answered, though I haven't found it via search.

In my report model I have a lookup entity that consists of a Code field (PK) and a Description field this is linked to a parent entity (table) and works fine, e.g. the description is shown in the parent entity instead of the FK code. However this lookup entity would be useful linked to many other entities (tables) which use the same FK code linked to the lookup entity's Code field (PK) for use of the Description field. In my first attempt I linked the lookup to a second table entity but unlike the originally linked table entity, this is not shown as the description in report builder, only the role appears and I have to select the role then the description from the 2 fields displayed (Code, Description), additionally I get shown the related first table entity.

Firstly can a lookup entity be linked to multiple tables?
Secondly, if so am I forgetting something so only the description is shown like in the first linked table entity?
Thirdly, if I correct the problem is there a property I need to enable/disable to stop the first linked table entity appearing in the second table entity entity list in report builder or should I just leave it?

Any help/advice/suggestions would be appreciated, and apologies for long list of questions but all the books and help files I have used don't seem to use imperfect/real life data sources and examples.

Thanks

Andy

View 1 Replies View Related

Traditional Indexes Vs Clustered Column-store Index

Apr 3, 2015

I've been asked to look at using Clustered Columnstore indexes for one of my tables. The table contains about 5 million records with about 50 columns. The max field size is a NVarchar(MAX) with max field length currently of about 4k characters. It's only about a gigabyte's worth of data. The table is about 50% R/W operations. Currently, we have multiple indexes with no clustered index due to some performance issues that happened in the past. I've been attempting to determine if it's even really worth it to switch over. I feel that the table is still fairly small with minimal columns and don't believe there will be any noticeable improvement over traditional indexing.

View 3 Replies View Related

Power Pivot :: How To Get Back To Traditional Hierarchy Dimensional View

Jun 17, 2015

When ever I create a new Powerpivot from an AS cube, PowerPivot shows the data only in flattened PowerPivot format. How can I get back to traditional hierarchy dimensional view in Pivot table.

View 5 Replies View Related

Entities Design

Jan 31, 2006

Hi,
I’ve three questions, would someone answer them please,

I have 3 entities:
The book entity(BookNo,BookNmae,AuthorName,Price...etc), the MembershipCard entity(CardNo,MembershipNo,ClientNo,PublishDate,EmpNo..etc), and the Client entity(ClientNo,ClientName,ClientAddr,ClientPhoneBookNo,RequiredBookNo,..etc)
1-What is the relationship degree between them, is it ternary or binary?and Why?
I'm so confused ,my answer is ternary, I made a (1:m) relationship between the clients entity and the books entity (a client may buy more than one book), (1:m) relationship between the employee entity and the books entity (an employee may sell more than one book)and a (1:m) relationship between the employee and the Client(an employee may serve more than one client(is it right or it's (M:N)).
So is my answer is right or wrong, please help me to understand, I’m so confused.

2- Is the cardinality degree between the Client entity and the book entity , (0,N) for the client entity and (1:N) for the book entity??

3-What is the best model to use in designing data in general,Chen's model or Crow's Foot and why?I think it's Crow's one ,for it's more arranged and easy to read.

with thanks
deema

View 7 Replies View Related

Entities Missing

Apr 11, 2007

I created a report model with a single "data source view." The datasource view has three tables "Business, XRef, Employee" and a named query "PeopleCount" based on these tables. The smdl [design] view shows "Business, XRef,Employee" as "entities" and does not show the named query from the "data source view" (I don't know if that is normal). I published this report model to the reporting server (its showed "success").



I then used Report Builder to open the report model as a "chart", and it shows there is only one entity for me to play with, its called "XRef." Why do the other tables ("Business" and "Employee") not show up in the Report Builder's list of entities?



My own guess is that "XRef" is the only "actionable" table for making a chart. Indeed, I notice that among its "fields" is one called "Business Title" (which apparently comes from the Business table). But I also notice it does not have an "Employee Name." Why have the former and not the latter? Again, my own guess is that the type of the Employee.Name field, a nvarchar(MAX), might be considered unusable for reporting, since it is a "max" size. Thoughts?



I am using SQL Server 2005 RTM, which is running on Win 2K3 Server SP1.

View 1 Replies View Related

Can't See All Tables In Entities Pane

Dec 22, 2006

Why is it that only SOME of the tables in my database show up in the Entities pane?

There are a total of six tables in my database, yet only three of them are available to me in the Entities pane. I have looked at permissions, etc, and I am using the SA account. It seems like I should see either ALL or NONE of the tables, but that is not the case.

What am I missing?

View 1 Replies View Related

The Difference Between Composite And Weak Entities

Mar 21, 2008

Hi,

A Composite entity can be made out of two Primary Keys (PK) of two different entities. Therefore it can be called as a link table. Therefore the composite entity depends upon the other two entites. Therefore the composite entity is a exsitence dependent on the other two entities.

Therefore do every composite is a weak entity?

TY

View 3 Replies View Related

Searching Multiple Entities At A Time

Aug 27, 2005

Dear GroupCan anyone provide a sample query for the following scenario?Let's assume I want to search for an order someone placed which mightbe an individual or company. An individuals first name is stored incolumn FirstName And the individuls last name in column LastName of thecontact table and the company name is stored in column CompanyName ofthe company table.If a user issues a query with CName parameter how can I search allthese columns and tables at the same time to see if there's a match? Imight add that there's a column in the orders table that holds0=Contact 1=Company but ideally I don't want to use this column.Thanks very much for your help and efforts.Martin

View 2 Replies View Related

Modelling Entities That Are Unknown At Design Time

Oct 26, 2007

Hi Everyone,

I'm attempting to design a schema for a project I working on. The idea is that I can store a list of documents and associate meta data with them.

The problem is that I don't know what that meta data will be at design time. The user will create the meta data fields in the software. For the first design I just had a table called meta field that contained the meta field defintion, and another table called itemdata that contained the document primary key, the metafield primary key and a value encoded as a varchar. This works fine while the list of documents is small.

Another idea I've thought of is to have seperate tables for all of the metafields. This would allow me to be very specific about the values that can be stored in that column etc. It also turns out that for the kind of queries I'm doing its about 4 times as fast. The only problem is that the software will need to create these tables at run time.

What I would like to know is, is this a really bad idea? If so why?. Also are there any other ways I can store this kind of data?

The kind of queries I am doing are find all the documents where metafield 1 is A and metafield 2 is B and metafield 3 is C and metafield 4 is D etc.

Cheers,
Mark

View 4 Replies View Related

Representation For Deleted Entities: Difficult Question

Jul 20, 2005

Our customer (of our ecommerce system) wants to be able to preservedeleted entities in the database so that they can do reporting,auditing etc.The system is quite complex where each end user can belong to multipleinstitutional affiliations (which can purchase on behalf of the user).The end user also has a rich trail of past transactions affiliationsetc. Thus in the schema each user entity is related to many otherswhich in turn relate to yet others and so on.In the past when a user was deleted all of his complex relationshipswere also deleted in a cascading fashion. But now the customer wantsus to add a "deleted" flag to each user so that a user is never_really_ deleted but instead his "deleted" flag is set to true. Thesystem subsequently behaves as if the user did not exist but thecustomer can still do reports on deleted users.I pointed out that it is not as simple as that because the user entityis related to many, many others so we would have to add this "deleted"flag to every relationship and every other entity and thus have"deleted" past purchases, "deleted" affiliations - a whole shadowschema full of such ghost entities. This would overtime degradeperformance since now each query in the system has to add a clause:"where deleted = 0".I assume this is a standard problem since many organizations must havethis need of preserving deleted records (for legal or other reasons).I tried to talk them into creating a simple audit file where all thedeletions will be recorded in XML but they were not too happy withthat.Is there a more satisfying solution to this than have this "deleted"flag?Thanks for your help,- robert

View 9 Replies View Related

Report Builder-problem With Fields From Entities

Oct 16, 2007

Hi everybody,

When I've deployed a report model,in Report Builder I have 4 different entities at the same level,when I drag and drop the first field from one entity after I can't see the other three entities....What did I do wrong??
I don't understand ,if you could help me it would be great.

Have a nice day!

sandy

View 3 Replies View Related

SQL Server 2012 :: Convert Function Inconsistent With XML Entities?

Aug 27, 2014

I have the following data stored in a column in a table:

£10,000.00 & ' " % < > Guðmundsdóttir Björk Lårs Marqués María-Jose Carreño Quiñones

I query this in a stored procedure using the FOR XML clause and universal table, and store the result in an XML data type variable:

DECLARE@ResultXML
EXECUTE[someStoredProcedure] @Result OUTPUT

This data (as XML) is then written to a file; in order to do this, I CONVERT the data to NVARCHAR since there are unicode characters in the source:

DECLARE@strResultNVARCHAR(MAX)
SET@strResult= CONVERT( NVARCHAR( MAX ), @Result, 1 )

Now this works fine, except on inspection, SQLServer has decided to render the data thus:

£10,000.00 & ' " % < > Guðmundsdóttir Björk Lårs Marqués María-Jose Carreño Quiñones

Why it has changed the apos and quot entities to the corresponding character but not the other entities is beyond me.

how to preserve XML entities?

View 0 Replies View Related

How To Build Database To Support User-specified Entities And Attributes?

Jul 23, 2005

I have a database that tracks players for children's sports clubs. I haveincluded representative DDL for this database at the end of this post.A single instance of this database supports multiple clubs. I would like toadd support for letting each club define and store custom information aboutarbitrary entities. Basically, allows the clubs to define custom entities(i.e tables) and associated custom attributes (i.e. fields) that may berelated to existing tables (such as Player and FootballClub) or existingentities. For instance, a club may define a PlayerAssessment entity thatrecords all player assessments.To do this, I plan to support the following use case:1. FootballClub admin creates a new entity and gives it a name anddescription (Entity is only accessible to this FootballClub).2. FootballClub admin indicates that the new entity has a M:1 relationshipwith the Player table (this will add Player_ID as a FK attribute).- {An entity may have no relationships.}- {Relationships are also supported to other entities.}3. FootballClub admin specifies the names and domain/types of any dataattributes (i.e. fields) of the entity.- {An attribute's type may be constrained to a few allowable types likeRelationship, Integer, Float, Currency, Date, Time, DateTime, Name,Description and Memo.}4. System creates entity as specified.A few constraints:1. Any entity defined is "private" to the defining club. Other clubs aren'taware of it although they may define custom entities of their ownwith the same name and attributes. [Perhaps there is a way to sharedefinitions of identical entities?]2. A club doesn't have to define any custom entities.Ideas I've considered:1. Generate DLL and create actual tables- Restrict such customizations such that while admin is setting up entities,no other user is allowed to use the system.- Once entity definition is complete, generate an actual table using DLL.Table and column names might be changed to enforce uniqueness/validityconstraints - this suggests a need for table/column name mapping.- PROS: Easy to implement.- CONS: Doesn't scale since only a limited number of tables can be created.DDL on a live, shared system?. Scary!!All users for all clubs will be locked out while entity iscreated.2. Generate DDL and create actual tables in secondary database(s)- Same as above except that the user tables are created in secondary [,shared] databases.- PROS: Reassurance that DDL is never run on the "core" dataAll users don't have to be locked out.- CONS: Doesn't scale since only a limited number of tables can be created.{ Unless I start creating additional databases too!. }Still needs to DDL on a live, shared system.Has anyone done anything similar?. Any ideas on how it might be done?. Inparticular, is this possible without having to execute DDL on the livedatabase?Kunle=================== BEGIN DDL ===================CREATE TABLE FootballClub (Club_ID int IDENTITY,Name char(80) NOT NULL,Area char(4) NOT NULL,League char(4) NOT NULL,City char(30) NOT NULL,PRIMARY KEY (Club_ID))goexec sp_primarykey FootballClub,Club_IDgoCREATE TABLE Player (Player_ID int IDENTITY,First_Name char(30) NOT NULL,Initials char(30) NULL,Last_Name char(30) NOT NULL,Date_Of_Birth datetime NOT NULL,Position char(4) NULL,Club_ID int NULL,PRIMARY KEY (Player_ID),FOREIGN KEY (Club_ID)REFERENCES FootballClub)goexec sp_primarykey Player,Player_IDgoCREATE TABLE UserAccount (User_ID int IDENTITY,Club_ID int NOT NULL,FullName char(80) NOT NULL,Logon char(20) NOT NULL,PWD_Hash char(60) NOT NULL,PRIMARY KEY (User_ID, Club_ID),FOREIGN KEY (Club_ID)REFERENCES FootballClub)goexec sp_primarykey UserAccount,User_ID,Club_IDgoexec sp_foreignkey Player, FootballClub,Club_IDgoexec sp_foreignkey UserAccount, FootballClub,Club_IDgo=================== END DDL ===================

View 3 Replies View Related

Master Data Services :: Entities Drop Down Is Not Visible In Browser

Aug 12, 2015

I have configured master data services in my DB server and when i am going to explorer the entities and respected data by using navigating as below

[URL] -->Click to Explorer 

I am able to select  data for only one default entity, in entities drop down is getting hidden back side , please find below snap to clearance.
 
Note: I am using Internet explorer (11.0.9600.17239) to browse the solution.

View 2 Replies View Related

Entities Disappear From Report Builder Explorer When Datasource Is A Cube

Feb 1, 2007

I have scoured the internet looking for someone who has run into this issue with no such luck!
Product: Reporting Services 2005              Analysis Services 2005

Our users use Report Builder as an ad-hoc report tool. Data sources for Report Builder come from Report Servers and Analysis Servers.

I have run into issues where a user will select a source for their report that is based on an AS cube. When they select an attribute (field) from a selected entity in the Report Builder Explorer and drop it on the canvas, all entities except the one the field was selected from disappear.

For example:

A cube has a fact table called "Annual Income" with dimension of employee and demographics. In Report Builder, the entities would be listed in the left hand Report Builder Explorer window as

Annual Income
Employee
Demographics

If I select attributes from Employee or Annual Income, as usual, you will see the related hierarchies of the remaining entities. However, if I select an attribute from Demographics, then the Annual Income and Employee entities just disappear and all I can see is the Demographics entity and its attributes.

Has anyone run into this and if so, any ideas? This is becoming extremely frustrating. I have deleted and rebuild cubes, individual dimensions, and everything else I can think of.

Your responses are appreciated,
Scott

View 1 Replies View Related

Reporting Services :: Make Whole SSRS Report Repeat By Groups Of N Entities

Jun 14, 2015

Let's say I have an rdlc report for customers, and it has three sections with subreports:

CUSTOMER_INFO (name, phone, e-mail)
ITEMS
OBSERVATIONS

As the page only has 21cm and the report grows horizontally, I need to repeat the WHOLE report with all of its sections after every 4 customers. So if I have 5 customers, there would be three pages(let's say every subreport takes 1 page) for the first four customers, and then another three pages(with every section once again) just for one customer.

Is it possible? It doesn't seem somehing out of the ordinary, but I can't figure how to make it work. Everytime there is more than 4 customers, the report breaks its layout trying to accommodate the records in a new table below the tables of each subreport.

The expected result would be to bring all of exceeding data to new pages.

View 5 Replies View Related

Master Data Services :: Error Opening Entities In User Role Management

Apr 27, 2015

I am trying the assign the models to the user in the user management page. But when  I try to expand the + symbol next to the model and open the entities, I get the error that the object reference is not set for a object server instance.

View 2 Replies View Related

Can Any One Tell Me The Difference Between Cross Join, Inner Join And Outer Join In Laymans Language

Apr 30, 2008

Hello

Can any one tell me the difference between Cross Join, inner join and outer join in laymans language

by just taking examples of two tables such as Customers and Customer Addresses


Thank You

View 1 Replies View Related

How I Imported My SQL Database Entities Into My SQL Compact Database

Nov 29, 2006

Hello:

I am still working on my project, but figured I would share my findings with the community, on how I imported my SQL Server database tables into a new SQL Compact Edition database. Unfortunately, I haven't figured a workaround to the IDENTITY_INSERT issue, but other than that, I will proceed.

1) I downloaded and played with the tool presented in the article "Generate SQL Insert statements for your SQL Server 2000 Database" I made the following modifications . (my modification can be found here)
a) Disable scripting dependencies
b) Add a filter for objects to script
c) Prompt for each table from which to export data

2) From the scripts output by this tool, I had to (which I may integrate into the tool later... who knows)
a) Remove 'On Primary' statements after the create table statements.
b) Remove date defaults.
c) Most other SQL generated by the tool seemed to work.

3) Execute each 'Create Table' statement individually.

4) For the Data Import, I had to add semi-colons to the end of each Insert Line.

5) I Have found no workaround for the IDENTITY_INSERT issue. If anyone has a good idea, I would love to hear it. In my case, I was importing the DotNetNuke core store module tables populated with about 2500 products and 20+ categories consisting of a simple categories table and products table. I imported the categories table into a fresh MS Access database file, and then ran the update query against the attached products table in the original SQL Database, then regenerated the insert statements, and imported the data generating fresh product ID's. This database will only be read only, so it didn't matter about maintaining the Product ID's, just the relationship between the products and categories.

Separately, I found a great blog article on how to embed a SQL script as a resource for your application and run it on your applications first run, so my steps above would provide a quick foundation for generating that sql script.

 

View 3 Replies View Related

SQL 2012 :: Applications Cannot Connect Because Logins Cannot Connect To Their Default Databases

Oct 17, 2014

I designed the AlwaysOn wrong, but every time we fail over from primary server to another server, my applications cannot connect because the sql logins cannot connect to their default databases. Once I run the command to link the login with the user in the default database then the users are able to connect. Did I do something wrong when designing AlwaysOn?

View 9 Replies View Related

Integration Services :: How To Perform Left Restricted Join In Merge Join Transformation

May 22, 2015

I have two xml source and i need only left restricted data.

how can i perform left restricted join?

View 2 Replies View Related

Transact SQL :: Difference Between Inner Join And Left Outer Join In Multi-table Joins?

Oct 8, 2015

I was writing a query using both left outer join and inner join.  And the query was ....

SELECT
        S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname
FROM
        Production.Suppliers AS S LEFT OUTER JOIN
        (Production.Products AS P
         INNER JOIN Production.Categories AS C

[code]....

However ,the result that i got was correct.But when i did  the same query using the left outer join in both the cases

i.e..

SELECT
        S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname
FROM
        Production.Suppliers AS S LEFT OUTER JOIN
(Production.Products AS P
LEFT OUTER JOIN Production.Categories AS C
ON C.categoryid = P.categoryid)
ON
S.supplierid = P.supplierid
WHERE
S.country = N'Japan';

The result i got was same,i.e

supplier     country    productid    productname     unitprice    categorynameSupplier QOVFD     Japan     9     Product AOZBW    97.00     Meat/PoultrySupplier QOVFD    Japan   10     Product YHXGE     31.00     SeafoodSupplier QOVFD     Japan   74     Product BKAZJ    10.00     ProduceSupplier QWUSF     Japan    13     Product POXFU     6.00     SeafoodSupplier QWUSF     Japan     14     Product PWCJB     23.25     ProduceSupplier QWUSF    Japan     15    Product KSZOI     15.50    CondimentsSupplier XYZ     Japan     NULL     NULL     NULL     NULLSupplier XYZ     Japan     NULL     NULL     NULL     NULL

and this time also i got the same result.My question is that is there any specific reason to use inner join when join the third table and not the left outer join.

View 5 Replies View Related

Warning - The Join Order Has Been Enforced Because A Local Join Hint Is Used

Dec 23, 2014

I have two select statements, in between select statement taking UNION ALL . I need to avoid the error

Warning: The join order has been enforced because a local join hint is used.

View 9 Replies View Related

'Left Outer Merge Join' Failing To Join Valid Row

Aug 10, 2007

Scenario:

OLEDB source 1
SELECT ...
,[MANUAL DCD ID] <-- this column set to sort order = 1
...
FROM [dbo].[XLSDCI] ORDER BY [MANUAL DCD ID] ASC


OLEDB source 2
SELECT ...
,[Bo Tkt Num] <-- this column set to sort order = 1
...
FROM ....[dbo].[FFFenics] ORDER BY [Bo Tkt Num] ASC

These two tasks are followed immediately by a MERGE JOIN

All columns in source1 are ticked, all column in source2 are ticked, join key is shown above.
join type is left outer join (source 1 -> source 2)

result of source1 (..dcd column)
...
4-400-8000119
4-400-8000120
4-400-8000121
4-400-8000122 <--row not joining
4-400-8000123
4-400-8000124
...


result of source2 (..tkt num column)
...
4-400-1000118
4-400-1000119
4-400-1000120
4-400-1000121
4-400-1000122 <--row not joining
4-400-1000123
4-400-1000124
4-400-1000125
...

All other rows are joining as expected.
Why is it failing for this one row?

View 1 Replies View Related

Connect To Object Explorer But Cannot Connect To Integration Services.

Mar 9, 2006



I try to import my SSIS packages which are created using the Business Intelligent studio into SQL server 2005 but I cannot do that.

I am running SQL server 2005 enterprise edition.

Also when i tried to connect to Integration services using Object explorer, it only prompt me for server name. I cannot change the username and password which is disabled.

Then how am i supposed to connect to Integration services on a server in this case?

View 4 Replies View Related

Cannot Connect W/ Java App But Can Connect W/ .Net App - SQL Server Express 2005

Dec 12, 2006

I'm having a problem connecting with a Java application but I CAN connect using my .Net application - the user name and password are the same for both (using the same database on SQL Server Express 2005).

The error I get is: "com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "CORNERS" requested by the login. The login failed." An interesing note - I get the same message if the database is not running.

SQL Server Express 2005 is installed in mixed mode.

Here is my connection string in the .Net appplication: <add key="connectString" value="Server=(local);UID=sa;PWD=myPasswd;Database=CORNERS" />.

These are my values in my Java app web.xml -

<init-param>
<param-name>DBDriver</param-name>
<param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
</init-param>
<init-param>
<param-name>DBURL</param-name> <param-value>jdbc:sqlserver://localhostsqlexpress:1055;databaseName=CORNERS</param-value>
</init-param>
<init-param>
<param-name>DBUser</param-name>
<param-value>sa</param-value>
</init-param>
<init-param>
<param-name>DBPwd</param-name>
<param-value>myPasswd</param-value>
</init-param>.

And yes, the port is 1055 - I checked to find it.

I am using Microsoft SQL Server 2005 JDBC Driver 1.0 (sqljdbc_1.0.809.102).

Does anyone have any idea what is wrong so that the login fails in the Java application but works in the .Net application?

View 7 Replies View Related

Multi-table JOIN Query With More Than One JOIN Statement

Apr 14, 2015

I'm having trouble with a multi-table JOIN statement with more than one JOIN statement.

For each order, I need to return the following: CarsID, CarModelName, MakeID, OrderDate, ProductName, Total ordered the Car Category.

The carid (primary key) and carmodelname belong to the Cars table.
The makeid and orderdate belong to the OrderDetails table.
The productname and carcategory belong to the Product table.

The number of rows returned should be the same as the number of rows in OrderDetails.

View 2 Replies View Related

Select Command - Left Join Versus Inner Join

Aug 9, 2013

Why would I use a left join instead of a inner join when the columns entered within the SELECT command determine what is displayed from the query results?

View 4 Replies View Related

Merge Join (Full Outer Join) Never Finishes.

Jun 5, 2006

I have a merge join (full outer join) task in a data flow. The left input comes from a flat file source and then a script transformation which does some custom grouping. The right input comes from an oledb source. The script transformation output is asynchronous (SynchronousInputID=0). The left input has many more rows (200,000+) than the right input (2,500). I run it from VS 2005 by right-click/execute on the data flow task. The merge join remains yellow and the task never finishes. I do see a row count above the flat file destination that reaches a certain number and seems to get stuck there. When I test with a smaller file on the left it works OK. Any suggestions?

View 3 Replies View Related

Why Does My Query Timeout Unless Force Join To Hash Join?

Jul 25, 2007

I'm using SQL Server 2005.



A piece of software I wrote starting timing out on a query that left outer joins a table to a view. Both the table and view have approximately the same number of rows (about 170000).



The table has 2 very similar columns, one is a varchar(1) and another is varchar(100). Neither are included in any index and beyond the size difference, the columns have the same properties. One of the employees here uses the varchar(1) column (called miscsearch) to tag large sets of rows to perform some action on. In this case, he had set 9000 rows miscsearch value to "g". The query then should join the table and view for all rows where miscsearch is set to g in the table. This query takes at least 20 minutes to run (I stopped it at this point).

If I remove the "where" clause and join all rows in the two tables, the query completes in about 20 seconds. If set the varchar(100) column (called descrip) to "g" for the same rows set via miscsearch, the query completes in about 20 seconds.



If I force the join type to a hash join, the query completes using miscsearch in about 30 seconds.



So, this works:

SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER HASH JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE miscsearch = 'g' ORDER BY balance DESC



and this works:

SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE descrip = 'g' ORDER BY balance DESC



But this does't:

SELECT di.File_No, prevPlacements, balance,'NOT PLACED' as status FROM Info di LEFT OUTER JOIN View_PP pp ON di.ram_file_no = pp.file_no WHERE miscsearch = 'g' ORDER BY balance DESC



What should I be looking for here to understand why this is happening?



Thanks,

john















View 1 Replies View Related

Page 2 - Within The INNER JOIN, How To Limit The Row To 1 Row Inside The INNER JOIN?

Apr 24, 2007

Awesome! I don't alway get the email notification of whoever reply to the posting. I think it only work after I log off of the forum.

Scott

View 2 Replies View Related

Changing From Implicit Join To Explicit Join

Dec 24, 2013

We are trying to migrate from sql 2005 to 2012. I am changing one of the implicit join to explicit join. As soon as I change the join, the number of rows returned are fewer than before.

Below is my Implict join query

INSERT #RIF_TEMP1 (rf1_row_no,rf1_rif, rf1_key_id_no, rf1_last_date, rf1_start_date)
SELECT currow.rf0_row_no, currow.rf0_rif, currow.rf0_key_id_no, prevrow.rf0_start_date, currow.rf0_start_date
FROM #RIF_TEMP0 currow , #RIF_TEMP0 prevrow

[Code] ....

and below is explict join query

INSERT #RIF_TEMP1 (rf1_row_no,rf1_rif, rf1_key_id_no, rf1_last_date, rf1_start_date)
SELECT currow.rf0_row_no, currow.rf0_rif, currow.rf0_key_id_no, prevrow.rf0_start_date, currow.rf0_start_date
FROM #RIF_TEMP0 currow LEFT JOIN #RIF_TEMP0 prevrow
ON (currow.rf0_row_no = prevrow.rf0_row_no + 1)

[Code] ....

the count returned from both the queries is different.

I am not sure what am I doing wrong. The count of #RIF_TEMP0 is always 32, it never changes, but the variable @countTemp is different for both the queries.

View 7 Replies View Related







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