|
You can't use an outer join in this scenario because outer joins return nulls where there is not a match in the other table; You have matches.
A union query would be more appropriate in this case.
|
|
|
|
|
I was sorta pressed for time so I physically merged the two tables on the database but I'll be certain to try it again next time!
Thanks for the explanation though. But I thought Outer joins will return nulls because there was no corresponding columns that had a value (of course, now that I type this I remember that all this is row based).
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
|
hi i have a table with following schema
MsgID SystemID Msg Date(YYYY-MM-DD)
1 1 "" 2009/01/02
2 1 "" 2009/04/03
3 1 "" 2009/05/02
4 2 "" 2009/01/01
I want to identify the SystemIDs which has messages (column : Msg) generated with a Time difference greater than 3 months
In the given table its systemID "1" . ( logged first message on 2009/01/02 and after 3 months 2009/04/03).
please help to get a proper query
My small attempt...
|
|
|
|
|
And what have you tried so far, or are you expecting someone to write the query for you. Some hints.
Select top #n
datetime
dateadd
datediff
row_number() partition over
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
don't understand.
plz send codez ASAP to lazy@yahoo.in
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
In one of the project they used System.Data.OleDb for connecting the SQL Server 2000 database. How does it differ from using System.Data.SqlClient.
Regards,
John.L.Ponratnam
|
|
|
|
|
Hi,
System.Data.SqlClient can only be used for SQL server. System.Data.OleDb is built to access a wide variety of databases as it is build on top of ODBC (for details look here: http://en.wikipedia.org/wiki/OLE_DB[^]).
I would suggest using the more common approach (ODBC or OleDB) as it gives you the opportunity to change your database provider without too much effects on your code.
Regards
Sebastian
|
|
|
|
|
hi guys ,
actually i replaced my ldf and mdf files accidently and
now my database has changed , but i want it to restore to previous
ldf and mdf files , what to do ? i replaced files from the path
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Hi,
Do you have any backup files of your database? Don't know if your recycle bin contains a copy of the old file (does this work when replacing files?).
Regards
Sebastian
|
|
|
|
|
Hi Guys,
I have created a program that exports data from our old system to a .sql file that drops/creates and inserts, which works fine, the only problem I have is automating.
How do you execute a SQL file from a DTS package?
Obviuosly the file changes on a daily basis, but the filename can remain the same.
Please help and thanks in advance,
Paul.
|
|
|
|
|
Paul Hayman wrote: How do you execute a SQL file from a DTS package?
that's a big ask in a forum message, you may find some tutorial and articles on Google [^]though
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually the solution was fairly easy, just a one liner sorted it using sqlcmd.
Thanks for your response though it's great that people do actually try and help.
Paul.
|
|
|
|
|
So what was the one liner?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Sorry, was just happy to have a solution didn't think of posting....
sqlcmd -U USERNAME -P PASSWORD -S SERVER -d DATABASE_NAME -i yourfile.sql
Pop that into a bat file and execute from the DTS package as a win32 process, all I need to do now is return a true or false from the bat file and pass back to the DTS package to confirm failure or success.
Probably sounds easier than it will be....
Paul.
|
|
|
|
|
Hy!
Here is the situation:
I am interested in ordering rows in a returned querie (full outer join querie) and I need to do the ordering for 2 columns. Now, the thing is, simple ORDER BY can't help me. If you use
ORDER BY column1, column2 the result is sorting querie by column1 and then column2. This does not satisfy my situation.
I wolud like sorting to be in a way that sorting happens for these 2 columns at once. I would like the result to look like this if it is possible:
column1 column2
25.5.1984 null
null 30.5.1985
null 17.5.1993
2.2.2005 null
The columns are type short date/time.
Cheers!
|
|
|
|
|
Try this
order by isnull(column1,column2)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Nice one!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
I just happened to need this today, in MySQL though. There the function exists and is called ifnull . Works great. Thanks.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
i wrote a command like 'select max(admission_no) from user_details'in ms access.but it is giving the error as 'characters found after end of sql statement'.Can anybody help me with this?
|
|
|
|
|
Please Give us more info. Where are you using this query ? from your code or this is in the Storeprocedure.
Give us more info so that we can help.
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.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Situation:
One of the columns in the table is with xml data type.
Every seconds table has ~30 row inserted. After couple of mounts there will be ~ 30row x 60s x 60min x 24h x 30day = ~78x10^6 rows for 1 month.
The goal is: very quick retrieve data from that table, where some queries will target xml column (specific data in xml element or attribute).
Did anybody have experience with xml column in this way? Did this way of returning data is slow, or can be quick with using xml indexes, or even using xml indexes this way of returning data is still slow?
___________________________
A.Petkovic
B.Sc.Eng., MCSD, MCT
|
|
|
|
|
if i understand you correctly , you have a field in your table that is of XML data type and has some xml in it and you want to retrieve a certain attribute(Column) in that XML. Then my frinend , that means form the begining you made a poor design decision when designing a database, and to loop through the data will be tedious for sql to retrieve the amaount of data you want. use another way.Give us more info , mybe we can help in the Logic that you can follow.
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.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I will try to explain, in one db I have 3 tables, because I want to return data as quick as possible to web services, I design 1 table with all necessary columns.
First design is without xml column, but number of rows will be at least 5x larger from design with xml column.
One of the solution is that I return data, and in web services to deal with xml column.
Second solution is that I return data filtered by xml attributes, or elements.
One more quick response is goal.
___________________________
A.Petkovic
B.Sc.Eng., MCSD, MCT
|
|
|
|