|
Friends i am going to develop a website which is like you tube.so i want to play an add first then i want to play the video on clicking the video file.so help me in writing the code. i wish to use two databases one for adds and other for videos.so please help me writing code
Sundeep
|
|
|
|
|
Please do not post questions asking people to write your code for you. Members of this site come here to help people who make an effort to learn and do their own work. If you do not know how to begin to create your project then find some online study guides, or buy some books.
|
|
|
|
|
If you are looking to get the code written then try Elance or one of the other code writing sites. CodeProject is for people who want to write their own code and need a little help learning.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi - I have having a join issue.
we have report which was set up a while ago, needs to be modified.
I have to add one more table, using a LEFT OUTER JOIN but using (+)!
I need to left outer join table B to table A, but it is a substring.
I tried which made sense syntax wise -
substr(A.source,1,4)=substr(B.OFFERNO,1,4)(+)
which did not work.
Below syntax did not error out - does this look right?
substr(A.source,1,4)=substr(B.OFFERNO(+),1,4)
|
|
|
|
|
From the Oracle language reference: The (+) operator can be applied only to a column, not to an arbitrary expression. However, an arbitrary expression can contain one or more columns marked with the (+) operator.
So the second syntax looks valid to me. Does it give you the expected results?
"The ones who care enough to do it right care too much to compromise."
Matthew Faithfull
|
|
|
|
|
You are right.
The second one worked for me.
Thank you!
|
|
|
|
|
If this is still confusing, you can create a view with the expression and then do your join on the view.
|
|
|
|
|
I am sure I am overlooking something very simple but I can't see it.
I have a database of locations with latitudes and longitudes. I need to be able to query for locations that fall within a given radius from a lat/lon point
The code I am intending to use is: (Showing fixed centre 38,-118 in this version)
SELECT quakeid, (6371 * acos(cos(radians(38)) * cos(radians(latitude)) * cos(radians(longitude) - radians(-118)) + sin(radians(38)) * sin(radians(latitude)))) AS [dkm]
FROM tblUSGSData
(Derived from Creating a store locator[^])
This works fine and returns just over half a million entries.
My problem is that as soon as I add
HAVING [dkm] <= 50
or
WHERE [dkm] <= 50
I get the message
Msg 207, Level 16, State 1, Line 3
Invalid column name 'dkm'.
I obviously have not got my SQL glasses on today as I can't seem to resolve this. Can any one make (polite) suggestions?
|
|
|
|
|
Well, [dkm] is an Alias, not a columnname.
You would need to have the same expression in the having or where clause as you have in the select clause.
"The ones who care enough to do it right care too much to compromise."
Matthew Faithfull
|
|
|
|
|
Ah yes. My bad
SELECT quakeid, latitude, longitude, (6371 * acos(cos(radians(37)) * cos(radians(latitude)) * cos(radians(longitude) - radians(-122)) + sin(radians(37)) * sin(radians(latitude))))
FROM tblUSGSData
GROUP BY quakeid, latitude, longitude
HAVING (6371 * acos(cos(radians(37)) * cos(radians(latitude)) * cos(radians(longitude) - radians(-122)) + sin(radians(37)) * sin(radians(latitude)))) <= 50
works - at least does not produce an error. Not sure about the working bit but that is another story.
Many thanks.
|
|
|
|
|
Are you sure you need to use Haversines formula?
If you Radiuses are small enough the Cartesian distance formula would do, depending on what coordinate system you're using of course.
Ignore that question, I just remembered what USGS is, and realized it's a different sort of Quake you're working with.
"The ones who care enough to do it right care too much to compromise."
Matthew Faithfull
modified 13-Feb-13 6:55am.
|
|
|
|
|
By the way, 50 km is about half a degree. Depending on the amount of rows in your table, it might be wise to filter for longitude between -122.5 and -121.5 and latitude between 36.5 and 37.5 first.
Also a simple transformation with 110 km/degree for latitude, and 110 * cos(latitude) for longitude, and then using simple pythagoras might speed up the query.
|
|
|
|
|
Thanks for your input. Yes I am adding some filtering now. I just needed to get the thing working first.
|
|
|
|
|
To add to Jorgen's answer, I've always wondered why SQL Server doesn't allow us to use alias in WHERE and HAVING clauses. The answer to that lies in the logical order in which the query is processed. The WHERE and HAVING clauses are processed before the SELECT clause and the alias do not exist at that stage.
However, technically it should be possible to introduce another stage earlier in the query processing pipeline where a mapping between expressions and their alias is made and WHERE and HAVING clauses can look up to these mappings and substitute the actual expression in place of the alias.
|
|
|
|
|
You are looking for CTE.
"The ones who care enough to do it right care too much to compromise."
Matthew Faithfull
|
|
|
|
|
Yes, or a simple
SELECT ... FROM
(
SELECT ... FROM table WHERE ...
) T
...
|
|
|
|
|
Yes, thats equivalent. I just prefer the readability of the CTE (which is merely an opinion) plus that you can refer to a CTE in more than one place.
"The ones who care enough to do it right care too much to compromise."
Matthew Faithfull
|
|
|
|
|
Ado.net is the Library in .net technology. this library help to you for connect your application to the database.
- Now Come in depth
C# is a language. and responsible to create the User Interface like Console, Web, and Window Application.
SQL is also language for create the database and database store the data.
Suppose i need to connect my Front-End to the Back-End.
or We say that C# Communicate to the SQL. now its not possible to two different language communicate to each other. Simple Example is
One Person is Russian and second is Indian now they want to talk to each other. Big Problem Occur when they want to communicate because Russian not known the Hindi language and similar Indian not know the Russian Language. now both person need to mediator or Converter. Converter convert the language means for Indian to Hindi and Russian to Russian Language.
-----Ado.Net Mediator between the Front-End to the Back-End-----
Ado.Net is provider to make the connection between the Front-End to the Back-End.
Thank you
Student of Dr. Sandeep Karan CAC Noida
Himanshu Sharma
|
|
|
|
|
And what is your question?
|
|
|
|
|
That's not a question, it's a Tip (or atleast he thinks so)
|
|
|
|
|
This is really a great tip for the beginners.
i thank you from all the Beginners those who need a Elaborated definition to understand the concepts..
|
|
|
|
|
|
What is the difference between truncating and deleting a table?
After the truncating or deleting do we need to re-index or shrink the table?
We are looking to do some clean-up on some rather large tables on our database. Once we do the clean-up what steps do we need to preform for overall database "health"?
Thanks!
|
|
|
|
|
mrfalk wrote: re-index
If there's no records left, there's little to reindex.
mrfalk wrote: What is the difference between truncating and deleting a table?
Google "MSDN Truncate", and from the manual we learn;
Removes all rows from a table without logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
So if we are using the Delete statement with the WHERE clause is it necessary to reindex? Is there a "standard" for when to reindex files?
After further research we will be using the delete clause because we want to retain a given number of days data. Within that given number of days data we will also be deleting specific rows based on a given parameter. We just want to make sure we are covering all bases.
|
|
|
|