|
Hi,
I have two tables, I need records of first table that is not in the result of innerJion of these two tables.
How could I obtain that?
Best wishes
|
|
|
|
|
are you try left join?
or something like that
select * from table1 where id not in (select table1.id from table1 inner join table2 on table1.id=table2.id)
|
|
|
|
|
Unfortunately I dont have a unique field in table1 niether table2.(as id)
I know it's terrible, but it's not my fault.
Best wishes
|
|
|
|
|
mehrdadc48 wrote: Unfortunately I dont have a unique field in table1 niether table2.(as id)
than how you applied Inner Join between these two tables?
|
|
|
|
|
without unique field that may identify the values, the inner join will produce cross product...
|
|
|
|
|
Actually, these two tables have same fields.
One is filled with old data, another has new data.
I made join on all of the fields, because they are same.
Best wishes
|
|
|
|
|
Hi All,,,
I want To Get the Constraint Of a veiw in sql server 2005
Please give me this query??
thanks
|
|
|
|
|
Please Please Before you Post you must First Understand what you want
Try again and tell us exactly what you want
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
Hi All,,
I Want To Get All Foreign Key From A Table And the Referenced Table Of This Foreign Key,,
How I Can DO That???
Thanks All;;;;
|
|
|
|
|
Look up INFORMATION_SCHEMA.TABLE_CONSTRAINTS in BOL.
Someone's gotta be the last to know, but why is it always me?
|
|
|
|
|
SELECT K_Table = FK.TABLE_NAME,FK_Column = CU.COLUMN_NAME,PK_Table = PK.TABLE_NAME,
PK_Column = PT.COLUMN_NAME,Constraint_Name = C.CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAME
INNER JOIN (
SELECT i1.TABLE_NAME, i2.COLUMN_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS i1
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2 ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME
WHERE i1.CONSTRAINT_TYPE = 'PRIMARY KEY'
) PT ON PT.TABLE_NAME = PK.TABLE_NAME
ORDER BY
1,2,3,4
|
|
|
|
|
Hi i am getting following error in error log files of iis.can anybody tell me about this.
The client was unable to reuse a session with SPID 628, which had been reset for connection pooling. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.
|
|
|
|
|
Hi,
Is it possible to have the following in sql?
IF @VarParam > 0 Exec(SELECT * FROM #TEMP1)
ELSE
Exec
(SELECT * FROM #TEMP1
UNION
SELECT * FROM #TEMP2)
Thank you
----------------------------------------------------------
Lorem ipsum dolor sit amet.
|
|
|
|
|
Hmmm... dunno, try:
EXEC (SELECT * FROM #TEMP1
UNION
SELECT * FROM #TEMP2 WHERE @VarParam > 0)
|
|
|
|
|
how to set sqlserver 2000 for accept remote connections ?
H.R
|
|
|
|
|
|
I saw many articles but i could not do that.
can any one help me with details ?
my application: VS.NET 2008 - C#
my DB: SQL Server 2000 personal edition
my windows: xp profesional sp3
H.R
|
|
|
|
|
Hi All,
Actually i have a problem in vista regarding a windows API SHOWWINDOW.
MY application is running in hide mode.I m Showing Window by using Findwindow() function.it runs successfully but sometimes in vista it runs successfully and software blinked in Taskbar. and it goes in background.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
If this is a database problem, I'm afraid I can't help you.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Dear All,
Is it possible to do one way replication using merge replication in MSSQL 2005?
if yes, plz provide me a reference.
thanks
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
i have solved the problem!
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
i am working on SQL2005.. i have installed Microsoft performance dashboard tool.
which let me know about cpu utilization graph on every second.
from last two days it showing me CPU utilization to 40%-50% and 10%-20% at some moment of time. but when it shows 40%-50% , there is no query in cache. on the other hand when it is on 10%-20% , there are so many queries in cache memory . and server computing power is fine in this case.
kindly tell me what is the reason behind this.?? and kindly let me know also how to make more and more queries to share the cache..
thanks in advance.
|
|
|
|
|
ASALAMOALEKUM ALL,
i have a following scenrio in my project:
I have two tables:
USER (user_id, user_name, course_id, course_name)
COURSE (course_id, course_name)
let suppose i have data in both the tables:
In USER:
user_id | user_name | course_id | course_name
--------------------------------------------------------]
1 | john | 1,2 |
2 | sam | 3,1 |
In COURSE:
course_id | course_name
----------------------------
1 | LAW
2 | HISTORY
3 | MEDICINE
now the issue is:
I HAVE TO WRITE A SQL QUERY OR STORED PROCEDUE WHICH INSERT course_name in USER table from COURSE table w.r.t course_id in USER table
i.e;
WHEN QUERY IS EXECUTED:
USER Table should be modified with:
user_id | user_name | course_id | course_name
--------------------------------------------------------
1 | john | 1,2 | LAW, HISTORY
2 | sam | 3,1 | MEDICINE, LAW
Please if anyone can help me... reply as soon as possible...
i am trying too but not getting any satisying way
Thanks!
Take care
$@N@
|
|
|
|
|
the design of your database tables are making things difficult.
I advise you to create another table where you store the relationship between user and courses and hence separate the user table from the details of courses.
tb_users :
user_id | user_name
tb_courses :
course_id | course_name
tb_attendances :
user_id | course_id
Thus you do'nt have to suffer from the complexities of having to set a multivalued field.
Hope this helps.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
modified on Sunday, March 1, 2009 3:22 PM
|
|
|
|
|
Can anyone offer their thoughts/suggestions on how to best breakup scripts for managing a db? For instance, I'm starting a new project, and have already used SQL Server Manager to create the tables, pk's, indexes and the relationship between tables. Does this need to all be scripted in one large script?
Moving forward, any changes that I may apply to the db (e.g. new table, new index) will have to be saved to the db. Should I create scripts for any incremental changes? What is the best way to capture these changes? Is there something in sql server manager that will say "capture changes" and script just the changes??
I guess the advantage of scripting all of your incremental scripts would be to easily back out changes that may have caused problems with your code.
Do you create one giant script with a bunch of ALTER statements for your VIEWS, SP's, FUNCTIONS, etc...?
Thanks
|
|
|
|