|
Try turning on the execution plan and examine the details. I doubt it makes any different at all as SQL interprets the query anyway.
Don't forget you can also have
Select *
From Table1, Table2
where Table1.something = 'value'
and table1.key = table2.key
I'm pretty sure the execution plan is the same but using the join style makes it more readable and therefore easier to support.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Good Morning Xmen W.K.
1)Select only the Column you want to display
2)The Second Query is a bad Query
3)Do you have indexes on the ID Field ?
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/
|
|
|
|
|
why select only one column if I need all of 'em...I know in that case ID column will appear twice as it will from both tables but its just an example...
and why second is bad ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen
i was wrong i misjudged your statements. The Queries are the same and the execution plan is the same in all parts.
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/
|
|
|
|
|
no problem
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi,
I have 4 tables in a cascading mode like this : 1)Countries --> 2)Chapionships --> 3) Teams --> 4) Coupons
Coupons table has 2 IDs (HomeTeamID and HostTeamID) that points to the Teams table.
It has also IDs for the tables (Countries and Chapionships)
All I want is to select the appropriate records from the Coupons Table, but instead of the foreing keys IDs I want the correspondence descriptions that these keys shows from their tables (ie Countries, Chapionships and Teams).
Is that possible ?
All I did until now is the query
SELECT * FROM Coupons LEFT JOIN (Countries, Chapionships, Teams)<br />
ON (Countries.CountryID=Coupons.CountryID AND Chapionships.ChapionshipID=Coupons.ChapionshipID AND ( Teams.TeamID=Coupons.HomeTeamID OR Teams.TeamID=Coupons.HostTeamID)) Where Date='2009-07-31' order by Time Asc;
but I get double rows for each record since there is an OR clause inside the ON. Any better solution ?
Regards
sdancer75
|
|
|
|
|
Use distinct or try to group.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
I am getting an exception thrown from my web app's call to a SQL SP.
The expecption says "incorrect syntax near '-'". The dash I have narrowed down to an argument passed to the stored procedure contains dashes, such as 992-123-123. The SP works fine if the argument passed is 992123123.
What is the best way of fixing this? In all likelyhood it is more important to keep the dashes in the entries in the columns. I think it is just my SP syntax, so here it is: @PACKAGE is the value that is giving issues, which is 999-999-999 style.
CODE
CREATE PROCEDURE dbo.sp_UpdateItemColumn
(
@PACKAGE nvarchar(255),
@COLUMN nvarchar(30),
@VALUE nvarchar(100),
@LASTCHANGEBY nvarchar(100)
)
AS
declare @sql nvarchar(1024)
set @sql=''
set @sql=@sql+'update tbl_swbom_checklist_items set '+@COLUMN+'='''+@VALUE+''' where package='''+@PACKAGE+''' '
--print @sql
exec sp_executesql @sql
GO
|
|
|
|
|
hi there,
please try to do below query. It is working perfect with the '-' value.
declare @sql nvarchar(1024)
set @sql=''
set @sql=@sql+'update tbl_swbom_checklist_items set ' + @COLUMN + '=' + '''' +@VALUE + ''' where @PACKAGE='''+ @PACKAGE +''''
exec (@sql)
Regards
|
|
|
|
|
I have a Tab control with 15 tabs. I am using the TabCtl.Value in Select statements to control the ListBoxes, Reports, etc. for each tab. It occurred to me that I could simplify this greatly by defining a Variant Array of the ListBox names and report names. Then I could simply use array(TabCtl.Value) instead of the Select Statement details.
The problem is that I cannot see how to make the array(TabCtl.Value) into a Control name that accepts property or method references. It seems like this should be simple, but I have tried a few things with no success.
I am using Access 2007 on Vista Bus 32. Here is a sample of my code: (I have used the same names for the Queries, ListBoxes, Reports, etc. as a way of maximizing the usefulness of the one array and as an aid to reducing misspellings during coding. I find this less confusing than a lot of similar names.)
'An Array of Query Names to use as the RowSource for A Tab ListBox.
Dim lstFindRptNames As Variant
lstFindRptNames = Array("lstByCusName", _
"lstByContact1", _
"lstByContact2", _
"lstByContact3", _
...
"lstByProspect", _
"lstByCustomer")
'Populate the ListBox by referencing a Query of the same name as the RowSource
lstFindRptNames(TabCtl0.Value).RowSource = lstFindRptNames(TabCtl0)
This fails because Access does not seem to substitute the String, in context, with the Control of the same name. So I tried to help it out with making a Control with a DIM first, I also tried a Generic Object. Neither of these lead to a solution.
In several other languages, other than VBA, this is a non-brainer. What am I missing?
"Coding for fun and profit ... mostly fun"
|
|
|
|
|
Assuming you want a solution for VB.NET, I would hold the references to the ListBoxes in a generic List (or even a Dictionary; not really an array), and most certainly not the names.
You then can use indexing, and even for each
In VBA, which I haven'tused for years, I would hope and use an array of ListBoxes.
BTW: you're in the wrong forum, this isn't a database question.
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.
|
|
|
|
|
Thanks for the hint. Not sure which Forum is correct.
I tried to use the References Idea. It does not seem to apply or I am not clear on its use in this case. I see it is a way to get at Tools-> References. Tools-> References includes a reference to my open project. But I can get to these objects directly any way.
Can you offer a snippet?
I am also trying:
TabCtl0.Pages(TabCtl0.Value).Controls but it only has count and item as properties and no methods.
Hmmm...
"Coding for fun and profit ... mostly fun"
|
|
|
|
|
Hi,
I still don't know which language you want: VB, VB.NET, VBA.
Anyway they all belong in the "Visual Basic"forum.
I don't have any VBx snippets handy right now (and almost none most of the time, I'm more of a C# kind of guy).
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.
|
|
|
|
|
VBA is what Access 2007 uses as default, as far as I know. I am forced to use a lot of different tools and languages in my projects. I am more comfortable with other languages as well.
I will try to more it to the VBx forum. I guess that is a cut and paste unless you are a moderator.
Thanks for the Hints.
PS: If you need help with Perl, maybe I can reciprocate.
"Coding for fun and profit ... mostly fun"
|
|
|
|
|
Hi Guys,
I'm in need of your help.
my problem is, i have two tables namely MASTER and LINECONTENT.
"MASTER" table contains 5,00,000 records,
The columns in MASTER table is
masterid int, masterdesc varchar(1000).
"LINECONTENT" table contains more than 1000 records &
its columns are pageno int, lineno int, content varchar(2000).
I want to compare each row of "MASTER" table, masterdesc column value with the "LINECONTENT" table content column,
If any records matched i want to take the matched master record and store it in another table.
for this i used the below query.
select b.* from linecontent a
join master b on a.content like '%'+b.masterdesc+'%'
but this query is taking much.
so we are going full text search option.
i enabled fulltext search MASTER table as well as LINECONTENT table.
but i dont know how to link these tables in freetext search.
IS THERE ANY OPTIONS LIKE THE BELOW ONE.
SELECT b.* FROM LineContent A
JOIN Master b ON FREETEXT(a.Content,b.MasterDesc)
for this scenario which method i have to follow to make the process faster.
please help me
thanks & regards
P.Prakash
|
|
|
|
|
I have a problem of trying to find the query for finding invalid dates in my table which does not follow the following formats. Given are the valid formats:
1. 10/1/2007
2. Thu Sep 20 06:32:10 GMT-0400 (EDT) 2007
3. 10/1/2007 5:00
Can anybody please help me regarding this?
Thanks in advance.
|
|
|
|
|
try this
select convert(varchar(10),cast(datevalue as datetime) ,120) from dateformats<br />
where convert(varchar(10),cast(datevalue as datetime) ,120) ='2007-10-01'
Date Thu Sep 20 06:32:10 GMT-0400 (EDT) 2007 will not work for this query because it will cause convertion error exception.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Hi,
I have install sql server 2005 on server. i can access server from client machine.
but the problem is when i try to access client from server,its not connecting.
am i missing some setting during installation? what could be the reason for this?
plz guide!
|
|
|
|
|
Spurple wrote: the problem is when i try to access client from server
This statement is wrong, the server does not know what/where the client is.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ok,
thank u for replying sir!
could u plz tell me any article to know more abt this!
|
|
|
|
|
Spurple wrote: ,its not connecting.
Did you get an error? What did it say?
Spurple wrote: what could be the reason for this?
Did you allow remote connections[^] over TCP/IP?
SQL Lingua Venusta
|
|
|
|
|
Do you mean the SQL Server or "the server" cannot see the client/work station?
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
What do you mean by access client from the SQL Server 2005....
Please put in some addl. details... usually, from client, the database server is connected...
|
|
|
|
|
I have a development database and production database.
The developers have added new tables and new rows to existing tables.
I need to merge these changes from the dev db to the prod db and am unable to construct a search to find an appropriate article.
Can someone help point me in the right direction?
|
|
|
|
|
Hey, these is a common thing when there are changes in the database schema.
In such a case, your developer must have documented the changes that they have made.
Create Alter scripts on the table with the changes on the schema and run the same on the Production environment to update the schema on the production.
But ensure you backup the production database before executing the alter scripts.
|
|
|
|