i have a table called Employee and Employees. i want to see if these tables have a same value on the following Fields "EmployeeName","Lastname", all this tables have the a Primary key called "Primary_KEY", how can i check if there is any record that is not the same and Display it. thanks
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
select E1.Primary_Key, E2.Primary_Key,
IsNull(E1.EmployeeName, E2.EmployeeName) AS EmployeeName,
IsNull(E1.LastName, E2.LastName) AS LastName
from Employee E1
full outer join Employees E2
on E1.EmployeeName = E2.EmployeeName
and E1.LastName = E2.LastName
where (E1.Primary_Key isnull or E2.Primary_Key isnull)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
i want to write a select statement. But i am connected to one server and i want to select on another database on another server????
How do i go about doing so?
if i run this script:
OPENROWSET('SQLOLEDB.1','Data Source=<OurServerName>;Initial Catalog=<OurDataBaseOnThatServer>;User ID=<OurUserName>;password=<OurPassword>;','SELECT TOP 1 FROM <OurServerName>.<OurDataBaseOnThatServer>.dbo.<TableNameInThatDataBase>') a
Am i doing something wrong??? i get an error: "Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'SQLOLEDB.1' reported an error."
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
I have seen that to use OPENROWSET command the first parameter should be MSDASQL
the SQLOLEDB is used for OPENDATASOURCE. i have tried this query and working perfectly. Also i hope that you have already enabled the OPENROWSET and OPENDATASOURCE command from the SQL server surface area configuration wizard.
Dealy day 2
Penalty Table will automati update P.Fine, Value will be 3.000
Delay day 3, day4....................... UpdateP.Fine
My Question is it possible to write some code inside my SQL SERVER datbase, Which will automatic check the B.DateDue column and (add or update Penaly Table where necessary)
I can write some function inside ASP.NET which will create a report for my needs but It will be taken more time.
I want my DataBase will check column status and put value to other table or same table where necessary.
Please tell me how can I do it? Any instruction will be really helpful.
Didn't you ask the same question last week? I gave you some advice then.
Use an INSERT...SELECT to select the records from the Borrower table where SubmitDate is greater than DueDate and insert corresponding entries into the Penalty table. Calculate the fine based on the logic I explained in my previous reply.
Can somebody tell me the easiest way to import data from and Excel sheet to a table in Sql Server 2005 database.
An immediate response would be appreciable.
Thanx in advance.
"If both of us are having one apple each and we exchange it, at the end we both will have one apple each. BUT if both of us are having one idea each and we exchange it, at the end both of us will be having two ideas each."
Last Visit: 31-Dec-99 18:00 Last Update: 21-Sep-23 23:38