Transact SQL :: Collation In Query Using Except Operation

May 28, 2015

when run this query 

  SELECT * FROM TABLE1
  EXCEPT 
  SELECT * FROM TABLE3

showing the below error

Msg 468, Level 16, State 9, Line 1
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the EXCEPT operation.here columns collation of table1 is Latin1_General_CI_AS and columns collation of table3 is SQL_Latin1_General_CP1_CI_AS database collation is Latin1_ General_CI_AS.

View 12 Replies


ADVERTISEMENT

Cannot Resolve Collation Conflict For Equal Operation

Aug 10, 2004

Hi, Im having a critical problem.

I have two databases: persons and cars

In database persons I have a table
named persons_class1 as follows:
person_id char(13) not null [primary key]
name varchar(20) not null

In database cars I have a table
named cars_blue as follows:
car_id char(13) not null [primary key]
model varchar(20) not null
person_id char(13) not null

In my program the initial catalog is: cars
and Im executing the following SQL:

select cars_blue.model,persons.dbo.persons_class1.name
from cars_blue,persons.dbo.persons_class1
where cars_blue.person_id=persons.dbo.persons_class1.person_id

and the following error occurs:
Cannot resolve collation conflict for equal operation

I also tried like instead of = and the error is:
Cannot resolve collation conflict for like operation

what can I do?

Thanks in advance
Roland

View 1 Replies View Related

Cannot Resolve Collation Conflict For Equal To Operation.

Jul 1, 2004

Anyone bang into that?

RESTORED a 7.0 Datbase CP 52 to a 2k box

Built a "Privacy" db from scratch on 2k box

Looked at some table scripts and got


OHM - sql 7

SQL_Latin1_General_CP1_CI_AS NULL

Privacy - sql 2k

Latin1_General_CI_AS NULL

[

Ran this and got the error...any help?


select * from privacy..privacy_column p inner join ohm.information_schema.tables t ON p.table_name = t.table_name


Server: Msg 446, Level 16, State 9, Line 1
Cannot resolve collation conflict for equal to operation.

Any ideas?

View 11 Replies View Related

Cannot Resolve Collation Conflict For Equal Operation

Aug 10, 2004

Hi, Im having a critical problem.

I have two databases: persons and cars

In database persons I have a table
named persons_class1 as follows:
person_id char(13) not null [primary key]
name varchar(20) not null

In database cars I have a table
named cars_blue as follows:
car_id char(13) not null [primary key]
model varchar(20) not null
person_id char(13) not null

In my program the initial catalog is: cars
and Im executing the following SQL:

select cars_blue.model,persons.dbo.persons_class1.name
from cars_blue,persons.dbo.persons_class1
where cars_blue.person_id=persons.dbo.persons_class1.per son_id

and the following error occurs:
Cannot resolve collation conflict for equal operation

I also tried like instead of = and the error is:
Cannot resolve collation conflict for like operation

what can I do?

Thanks in advance
Roland

View 8 Replies View Related

Cannot Resolve Collation Conflict For Equal To Operation.

Oct 19, 2004

Hi, I have this error when running a query:

Cannot resolve collation conflict for equal to operation.

but the situation is that I can run the query perfectly with one user (windows user) but using an standar user, I've got the error, as far as I know the collation feature applies to db's an objects not to users, what can I do to run this query with the standar user? both users have the same permission on the db. Below is the query attached.

Thank you
Gabriel

SELECT B.EmpSupervisorId, a.Info_ID as A_Info_ID,
ISNULL(a.Owner_SSO_ID,'') as A_Owner_SSO_ID,
ISNULL(a.Ref_SSO_ID,'') as A_Ref_SSO_ID,
ISNULL(a.Prev_Owner_SSO_ID,0) as A_Prev_Owner_SSO_ID,
ISNULL(a.MgmtTypeFlag,0) as A_MgmtTypeFlag,
ISNULL(a.CurrentStatusID, 1) as A_CurrentStatusID,
ISNULL(a.PrevStatusID,0) as A_PrevStatusID,
ISNULL(C.ConTypeOption, '') as C_ConTypeOption,
ISNULL(CAST(a.Last_Status_Update_Date AS VARCHAR),'') as A_Last_Status_Update_Date,
ISNULL(B.sfBUID,'0') as A_Bus_Group_ID, 0 AS A_Bus_Group_Seg_ID,
ISNULL(a.Organization,'') as A_Organization,
ISNULL(a.ContactName,'') as A_ContactName,
ISNULL(A.Title, '') as A_ContactTitle,
ISNULL(a.ContactComName,'') as A_ContactComName, ISNULL(a.Phone,'') as A_Phone,
ISNULL(a.NatureOfOppID,'') as A_NatureOfOppID, ISNULL(a.DealAmount,0) as A_DealAmount, ISNULL(CAST(a.Cust_Contacted_Date AS VARCHAR),'') A_Cust_Contacted_Date, ISNULL(CAST(a.Lead_Qualified_Date AS VARCHAR),'') A_Lead_Qualified_Date, ISNULL(CAST(a.Tran_Processed_Date AS VARCHAR),'') A_Tran_Processed_Date,
ISNULL(CAST(a.Quote_Accepted_Date AS VARCHAR),'') as A_Quote_Accepted_Date,
ISNULL(CAST(a.Approved_By_HFS_Date AS VARCHAR),'') as A_Approved_By_HFS_Date,
ISNULL(CAST(a.Funded_By_HFS_Date AS VARCHAR),'') as A_Funded_By_HFS_Date,
ISNULL(a.Lead_In_Amount,0) as A_Lead_In_Amount,
ISNULL(a.Cust_Contacted_Amount,0) as A_Cust_Contacted_Amount,
ISNULL(a.Lead_Qualified_Amount,0) as A_Lead_Qualified_Amount,
ISNULL(a.Tran_Processed_Amount,0) as A_Tran_Processed_Amount,
ISNULL(a.Quote_Accepted_Amount,0) as A_Quote_Accepted_Amount,
ISNULL(a.Approved_By_HFS_Amount,0) as A_Approved_By_HFS_Amount,
ISNULL(a.Funded_By_HFS_Amount,0) as A_Funded_By_HFS_Amount,
ISNULL(CAST(CreationDate AS VARCHAR),'') as A_CreationDate,
ISNULL(a.BusType,'') as A_BusType,
ISNULL(a.NonHFS_XLink_ContactName,'') as A_NonHFS_XLink_ContactName,
ISNULL(a.NonHFS_XLink_Bus_ID,'0') as A_NonHFS_XLink_Bus_ID,
ISNULL(a.Comments,'') as A_Comments, ISNULL(a.ExistCustomerID,'') as A_ExistCustomerID,
ISNULL(a.FinancialNeedID,'') as A_FinancialNeedID,
ISNULL(a.CampaignID,'') as A_CampaignID,
(GEC_HFS_CORE.dbo.GetBusinessDays(Last_Status_Upda te_Date, getdate())-1) as BusDateDiff, ISNULL(A.DealTypeID, '') as A_DealTypeID
FROM tblInformation a
LEFT OUTER JOIN GEC_HFS_LM_SSOInfo B ON A.Owner_SSO_ID = B.sfSSOID
LEFT OUTER JOIN tblContactType C ON a.Bustype = C.ConType_ID
WHERE a.CurrentStatusID NOT IN (9, 10, 11) AND
ISNULL(a.isNoChange,'NO') = 'NO' AND ISNULL(a.IsDeleted,'NO') = 'NO' AND
DATEDIFF(DAY, Last_Status_Update_Date, GETDATE())<> 0 AND
ISNULL(a.isNonHFS, 'NO') = 'NO'
ORDER BY A_Info_ID

View 3 Replies View Related

Cannot Resolve Collation Conflict For Equal To Operation.

Dec 16, 2005

I've stumbled across the above error and am a little stuck.I've just installed SQL2000 (sp3) on my PC and restored a database fromour Live server. On a simple Update statement on a #temp table, itfails with the above message. I think I understand what it means andfound some old posts suggesting using the following :select name, databasepropertyex(name, 'collation')from master..sysdatabasesselect serverproperty('collation')All of the databases that are there by default are set to'Latin1_General_CI_AS' and the restored db is'SQL_Latin1_General_CP1_CI_AS'.The live server has all of these set to the 'SQL...' version, but astandard install points to the other. So, how do I change mine to the'newer' setting ? All I need to do is mimic the live environment fortesting and development. There is only me using it, and it's not aproblem to bin it and re-install, or tweak if I need to.I've tried using :ALTER DATABASE Northwind COLLATE SQL_Latin1_General_CP1_CI_ASas a test (thought this was the best example to show), but it failsstating the following :Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_Products_UnitPrice' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_ReorderLevel' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_UnitsInStock' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_UnitsOnOrder' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_Discount' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_Quantity' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_UnitPrice' is dependent on database collation.Server: Msg 5075, Level 16, State 1, Line 5The object 'CK_Birthdate' is dependent on database collation.Server: Msg 5072, Level 16, State 1, Line 5ALTER DATABASE failed. The default collation of database 'Northwind'cannot be set to SQL_Latin1_General_CP1_CI_AS.On the Live server, the Northwind database is set to the 'SQL...'version, so it MUST be do-able somehow.Any pointers would be appreciated.Thanks in advanceRyan

View 7 Replies View Related

Cannot Resolve Collation Conflict For Equal To Operation

Nov 27, 2007



Hi All,

I have collation defined on one column and default on another being used in where clause. How can I resolve this problem without changing collation in table.

Thanks in advance

Niraj

View 1 Replies View Related

Error:Cannot Resolve Collation Conflict For Equal To Operation.

Sep 2, 2004

Exception information:System.Data.SqlClient.SqlException: Cannot resolve collation conflict for equal to operation.
Who can tell me how to resolve this problem?
Thx

View 3 Replies View Related

Error While Calling The Roles.AddUserToRole (error Message: Cannot Resolve Collation Conflict For Equal To Operation)

Feb 5, 2006

Hi, I have developed a website in asp.net 2. I have tester it and it is working fine on my computer but when I have uploaded it to my server I'm getting an error message when the user signup. The error occurs when I'm setting the user role to 'members'.
 
Error line > Roles.AddUserToRole(user.UserName, "members")
 
The strage thig is that it is working on my computer but not on the server. My home computer and the server are running the same software versions and the website database is the same as well.
 
To double check that my code is not generating the error I have lonched 'SQL Query Analizer' and executed the folowing code on my database:
NOTE: In my database I have create the user “teeluk12? and a role “members?
 
aspnet_UsersInRoles_AddUsersToRoles "/", "teeluk12", "members", "5/02/2006 4:44:33 pm"
 
Once again the code is working on my home computer but not on the server. On the server I'm getting the following error:
 
Server: Msg 446, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 76
Cannot resolve collation conflict for equal to operation.
 
 
 
Does anybody know what could cause the error?
Could it be some permissions that I didn't set on my server?
 
 
Thanks for my help and suggestions...
Regards,
Gonzal
 

View 9 Replies View Related

Transact SQL :: Changing Collation On Import

Sep 16, 2015

I'm importing data from a table on one database into a table in another database on the same instance. The FROM database is collated as "Latin1_General_CI_AS" and the TO database is collated as "SQL_Latin1_General_CP1_CI_AS".

When I then try joining on a common nvarchar column between the 2 tables, I get this error:

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.

Is there a way to change the collation of the incoming data as I'm inserting it into the TO table?

View 5 Replies View Related

Transact SQL :: Cannot Perform Shrink File Operation Inside User Transaction

Sep 18, 2015

I am getting an error about "Cannot perform a shrinkfile operation inside a user transaction", but I don't have a shrinkfile command in my procedure.  Does SQL hang on to that command if it was received earlier in a different procedure?

View 5 Replies View Related

Transact SQL :: Truncate And Insert Operation - Avoid No Rows In Table During Processing

Oct 22, 2015

I have a job which executes hourly.

Essentially:

Begin
Truncate table A
Insert into A
(Col1,
Col2,
Col3...
)
Select Value1,
Value2,
Value3...
From Table B
End

The insert operation query takes approximately 3.5 minutes to execute. What's occurring is the Table is immediately truncated, and there are no rows in the table for those 3.5 minutes.

How can I avoid having this gap - where there are no rows in the table for that period of time during the job execution ? The table could be locked, but that doesn't seem like the best solution.

View 8 Replies View Related

Transact SQL :: Split Date Range Into Monthly Wise And Loop Through Each Month To Perform Some Operation

Oct 20, 2015

Let's say if the date is 01/01/2015 till 01/01/2016

I want split these dates monthly format wise and then use them in variable in cursors to loop

For an example Monthly date should be 01/01/2015 and 01/31/2015 and use these two values in 2 variables and make a loop until it never ends whole date range which is 01/01/2016

View 2 Replies View Related

SQL 2012 :: Current Operation Cancelled Because Another Operation In Transaction Failed

Nov 20, 2013

I'm using SQL Server 2012 Analysis services in Tabular mode and connected to Oracle Database and while importing, I'm getting below error after importing some rows.

OLE DB or ODBC error: Accessor is not a parameter accessor.. The current operation was cancelled because another operation in the transaction failed.

View 1 Replies View Related

Problem On Query Operation

Apr 30, 2006

Hello, I have my table Produits :
CREATE TABLE [dbo].[Produit] ( [Produit_ID] [int] IDENTITY (1, 1) NOT NULL , [Reference] [nvarchar] (50) COLLATE French_CI_AS NULL , [Designation] [nvarchar] (50) COLLATE French_CI_AS NULL , [Quantite] [int] NULL , [PrixU] [sql_variant] NULL , [MontantHT] [sql_variant] NULL , [TVA] [sql_variant] NULL , [Facture_ID] [int] NOT NULL )GOhere is stored procedure CREATE PROC spBaseTVA_Bis
(
@Facture_ID int

)
AS

SELECT SUM(MontantHT) AS montantHT, TVA

FROM

Produit

GROUP BY TVA, Facture_ID
HAVING ( Facture_ID = @Facture_ID)
GO

My stored procedure  fill data in a datagrid with to column  TauxTVA and TVA  like this :    TauxTVA      TVA But I would like to add a theard column as (the value of the fisrt colum) *  ( the value of the second colum )     I would like to desplay data like this  :          TauxTVA      TVA    Prod       X           Y     X*Y       How can I modify my stored procedure to perform this ?     Regards  

View 3 Replies View Related

SQL Server 2005: Changing Latin1_General_BIN Collation To Latin1_General_CI_AS Collation

May 1, 2007

Hello,



I've restored a SQL Server 2000 database with a Latin1_General_BIN collation from a .dmp file to a SQL Server 2005 server with a default collation of SQL_Latin1_General_CP1_CI_AS. When I try to change the database collation I get hundreds of the following error:

The object 'CK_PM10200_GLPOSTD_00AF8CF' is dependent on database collation. So, in this case, is it even possible to change the collation if there are objects in the database that are dependent on it?



Thanks,

Bruce

View 7 Replies View Related

How To Make The SSMSE To Return Whole Records Without Any Close Query Form And Re-create Query Form Operation?

Dec 25, 2007

Hi,
I got a problem.
I installed Microsoft SQL Server Management Studio Express 2005 version.
And I created a Compact database.
I created an connection in SSMSE to connect the database and opened a query form.
then, i run the following sql:

Select * from Table1

It returned 3 records to me.
After that, I used program to insert record into this table.
Then i ran this sql again, it still show me 3 records.
I closed the query form, and re-created a new query form, then run the sql, it returned 4 records to me.

Why? It's very strange and difficult to operate, right?
Is there anyone know how to make the SSMSE to return whole records without any close query form and re-create query form operation?

Thanks a lot!

And Merry X'max!!!

View 4 Replies View Related

How To Change Collation On Sysdiagram To Default Collation Of Database

Sep 15, 2014

I changed the default collation of a database and every table within that except sysDiagrams , which I can't even through the designer .

View 9 Replies View Related

Sql Query Timeout, Expensive Cast Operation?

Jul 23, 2005

I need some tips to boost the performance on the following query.The problem is that it times out once in a while, and then again runsnormally in most cases.The clue is to compare a textual value stored as an image data type, but Idon't know if the cast operation could be done in another way.Any tips?SELECT DISTINCT pk_product FROM tbl_product PJOIN tbl_product_content PC ON P.pk_product = PC.fk_productJOIN tbl_content C ON PC.fk_content = C.pk_contentJOIN tbl_content_rel REL ON C.pk_content = REL.fk_contentJOIN tbl_filegroup FG ON REL.fk_filegroup = FG.pk_filegroupJOIN tbl_filegroup_file FF ON fg.pk_filegroup = FF.fk_filegroupJOIN tbl_file F ON ff.fk_file = F.pk_fileWHEREP.fk_product_type = 45 ANDCAST(CAST(f.data AS VARBINARY) AS NVARCHAR(20)) = '1234'/ted

View 1 Replies View Related

T-SQL (SS2K8) :: Query Be Rewritten With Merge Statement So That Whole Operation Is Atomic?

Sep 14, 2015

I would like to have a 'counter' table which will hold the last used number and return a new number. This is my schema:

if object_id('tempdb.dbo.#Counter', 'u') is not null drop table #Counter
go
create table #Counter (
Id int not null
)
go
if exists (select * from #Counter)
update #Counter
set Id = Id + 1
output inserted.Id
else
insert into #Counter (Id)
output inserted.Id
select 1

If the table is empty it returns 1 else it returns the next number (Id + 1). But this query is not atomic (i guess...?) so it could evaluate that the #Counter table is empty and then try to insert into the table, but inbetween someone else executes the insert also. Could this query be rewritten with the merge statement so that the whole operation is atomic?

View 9 Replies View Related

Query Error: Collation Conflict (on Tables On 2 Different Servers)

Jun 30, 2005

Hi all,



I have a query that I need to run where I join two tables that both
reside on different servers. I use an INNER JOIN statement to attempt
to join these tables, but for some reason I am getting the following
error message...

"

Cannot resolve collation conflict for equal to operation."


The query is as follows...

SELECT    TABLE_NAME, LEFT(TABLE_NAME, CHARINDEX('_', TABLE_NAME + '_') - 1) AS Abbreviation
FROM     mrcsmis.INFORMATION_SCHEMA.TABLES
INNER JOIN DEVELCAD1.Portal.dbo.dnl_db_names_log AS imp ON (imp.dnl_table_name = TABLE_NAME)
WHERE     (TABLE_TYPE = 'BASE TABLE')

Thanks

Tryst

View 3 Replies View Related

What Collation To Have Ascii Character 160 Display In Query Results

Feb 11, 2008

I have an issue with some data that has a leading ASCII char 160 (the "a" with the accent mark) but it shows in query results as a space.


... where customername like char(160) + '%'

returns 2 rows but shows the customer name with a leading space. How would I change the collation or do otherwise to get this character to display correctly in the results?

Thanks!

-Dave

View 6 Replies View Related

Execution Of A Full-text Operation Failed. A Clause Of The Query Contained Only Ignor

Jan 31, 2006

Hi.

I get the following error

Quote: Execution of a full-text operation failed. A clause of the query contained only ignored words.

because I try to search words that are 2 characters like "me" or like " on "

why can't I use words that are 2 characters in sql query by using the contains function?

View 1 Replies View Related

SQL Server 2008 :: How To Get The Collation Name From A Collation ID

Oct 15, 2015

I am using SQL Server 2008. In ServerProperty function, there are two properties called “Collation” and “CollationID”. In some cases, I will only know the CollationID. Is it possible get the collation name from the CollationID? Is there a function called CollationNameFromID?

View 1 Replies View Related

DB Engine :: How To Get Collation Name From Collation ID

Oct 16, 2015

I am using SQL Server 2008. In ServerProperty function, there are two properties called “Collation” and “CollationID”. In some cases, I will only know the CollationID. Is it possible get the collation name from the CollationID? Is there a function called CollationNameFromID?

View 2 Replies View Related

Transact SQL :: Adding Results Of Query To Another Query Via Dynamically Added Columns

Jul 30, 2015

For each customer, I want to add all of their telephone numbers to a different column. That is, multiple columns (depending on the number of telephone numbers) for each customer/row. How can I achieve that?

I want my output to be

CUSTOMER ID, FIRST NAME, LAST NAME, TEL1, TEL2, TEL3, ... etc

Each 'Tel' will relate to a one or more records in the PHONES table that is linked back to the customer.

I want to do it using SELECT. Is it possible?

View 13 Replies View Related

Transact SQL :: Use Query Results As Select Criteria For Another Query

Jul 10, 2015

I have a query that performs a comparison between 2 different databases and returns the results of the comparison. It returns 2 columns. The 1st column is the value of the object being compared, and the 2nd column is a number representing any discrepancies.What I would like to do is use the results from this 1st query in the where clause of another separate query so that this 2nd query will only run for any primary values from the 1st query where a secondary value in the 1st query is not equal to zero.I was thinking of using an "IN" function in the 2nd query to pull data from the 1st column in the 1st query where the 2nd column in the 1st query != 0, but I'm having trouble ironing out the correct syntax, and conceptualizing this optimally.

While I would prefer to only return values from the 1st query where the comparison value != 0 in order to have a concise list to work with, I am having difficulty in that the comparison value is a mathematical calculation of 2 different tables in 2 different databases, and so far I've been forced to include it in the select criteria because the where clause does not accept it.Also, I am not a DBA by trade. I am a system administrator writing SQL code for reporting data from an application I support.

View 6 Replies View Related

Transact SQL :: SELECT On Column Name From Query Result Set In Same Query?

May 9, 2015

I have a column colC in a table myTable that has a value (e.g. '0X'). The position of a non-zero character in column colC refers to the ordinal position of another column in the table myTable (in the aforementioned example, colB).

To get a column name (i.e., colA or colB) from table myTable, I can join ("ON cte.pos = cn.ORDINAL_POSITION") to INFORMATION_SCHEMA.COLUMNS for that table catalog, schema and name. But I want to show the value of what is in that column (e.g., 'ABC'), not just the name. Hoping for:

COLUMN_NAME Value
----------- -----
colB        123
colA        XYZ

I've tried dynamic SQL to no success, probably not executing the concept correctly...

Below is what I have:

CREATE TABLE myTable (colA VARCHAR(3), colB VARCHAR(3), colC VARCHAR(3))
INSERT INTO myTable (colA, colB, colC) VALUES ('ABC', '123', '0X')
INSERT INTO myTable (colA, colB, colC) VALUES ('XYZ', '789', 'X0')
;WITH cte AS
(
SELECT CAST(PATINDEX('%[^0]%', colC) AS SMALLINT) pos, STUFF(colC, 1, PATINDEX('%[^0]%', colC), '') colC

[Code] ....

View 4 Replies View Related

Transact SQL :: Query Plan Shows Table Not Even In Query?

Jul 22, 2015

I am trying to optimize a stored procedure in SQL 2008.  When I look at an actual execution plan generated from when I run it in SSMS it shows a table being used in the plan that has no relation to what is actually in the query script and this is where the biggest performance hit occurs.

I've never seen a table show up before that wasn't part of the query. why this might occur and how to correct it?  I can't just change the query script because the table in question isn't there.

View 10 Replies View Related

Problem With Transact SQL Query

Nov 12, 2007

Event





Event_ID

Person_ID

Event

Start_Date


1001

50

Referral

02-02-2007


1002

50

Appointment

03-02-2007


1003

50

Assessment

07-02-2007


1004

84

Referral

14-02-2007


1005

84

Appointment

20-02-2007


1006

50

Referral

01-03-2007


Outcome





OutcomeID

Person_ID

Event_ID

Outcome_Date

Outcome


4000

50

1001

02-02-2007


Appointment


4001

50

1002

03-02-2007

Assessment


4002

50

1003

09-02-2007

No Further Action


4003

84

1004

15-02-2007

Appointment


4004

84

1005

22-02-2007

No Further Action


4005

50

1006

03-03-2007

No Further Action

Result





Person_ID

Event_ID

Start_Date

OutcomeID

Outcome_Date


50

1001

02-02-2007

4002

09-02-2007


84

1004

14-02-2007

4004

22-02-2007


50

1006

01-03-2007

4005

03-03-2007

I have a problem writing a query for the above two tables Event and Outcome. The event table conisists of an event id, the person id, the event and the start date of the event. The Outcome table is the based on the outcome of the event; the table includes the outcome id, the person id, the event id, when the outcome decision was made (this can be after the event start date) and the outcome.

A client may have a referral which goes onto an appointment then an assessment. If the outcome is No Further Action then no further events take place. No Further action can be outcomed at any stage. A person may only have one event open at a time i.e. they cannot have a new referral if they have an assessment.

I want to create a query that displays when the referral started (event start_date) until it ended (when No Further Action was selected). Because a person may have referrals I am struggling with the query with regards to dates.

View 7 Replies View Related

Transact SQL :: How To Get Cumulative Value In Query

Aug 18, 2015

I have table like below, its period wise ,here the value get cumulative period wise.

amtname period
10CHR201202
20TNG201202
10CHR201203
20TNG201203

View 3 Replies View Related

Transact SQL :: Query To Get MAX Date

Jun 23, 2015

I need query to get the Max date of CODE.

OID   CODE   Current_date
3710 250    01/01/1997
3910 250    03/03/1998
4100 250    01/01/2014
1200 251    01/01/2013
1301 252    01/01/2001
1450 252    01/01/2014
1451 252    01/01/2015

Expected result after taking max(effdate) of CODE

OID   CODE   Current_date
4100 250    01/01/2014
1200 251    01/01/2013
1451 252    01/01/2015

View 7 Replies View Related

Transact SQL :: Run Query On 2 Servers?

Sep 24, 2015

i need to run query that will run on two servers.

one is local (Server1), and one on 192.144.22.22 (Server2)

i try this:

    SELECT  *
    FROM    [Db1].[dbo].table1 A
    INNER JOIN [Server2].[Db1].[dbo].table2 B 
    ON A.Id = B.Id

but this work fine because the two database is on the local machine.

how to do it ?

View 2 Replies View Related







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