 |
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
Hello everyone,
Can someone help me select rows between 2 dates en between 2 times.
I need to select all records from 02/09/2014 starting from time 05:00:00 until the next day time until 05:00
If I do it like this then it wont work, no records shows:
SELECT TOP 10000 *
FROM Staging.[dbo].AD
WHERE DATE_CREATED BETWEEN '02/09/2014' and '03/09/2014'
AND Convert(Time,TIME_CREATED) between '05:00:00' AND '05:00:00'
It should be something like this:
Between DATE_CREATED 02/09/2014, TIME_CREATED 05:00:00 and DATE_CREATED 03/09/2014, TIME_CREATED 05:00:00
Kind regards,
Ambertje
|
|
|
|
 |
SELECT TOP 10000 *
FROM Staging.[dbo].AD
WHERE DATE_CREATED BETWEEN '02/09/2014 05:00:00' and '03/09/2014 05:00:00'
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
 |
Thank you for the reply but this is not working, it's showing me all the records for both days, not the records between 05:00:00 and 05:00:00
|
|
|
|
 |
What datatype is time?
I'd recommend putting it in the DATE_CREATED column, where it belongs.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
 |
Why are you using nvarchar instead of DateTime ?
|
|
|
|
 |
Yes, kinda predictable.
It's a bad idea to do so, and should be fixed. The time you are saving is a culture-specific format, it is a text, something the computer does not calculate with.
A DateTime in a computer is a floating point. The integer-part counts the days passed since the epoch (start of counting of days, often 1/1/1900), the decimal part represents the time, in ticks. They are not two separate facts - and should be modelled as a single field, of the DateTime-datatype. The computer can easily calculate with those.
Breaking the date and time into separate fields is as usefull as using a separate field for the day, month, year, hour, minute and second. If they represent a single atomic fact, than that is how it should be modelled.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
 |
It's interesting that the Date type in Oracle while handled as a single entity but is stored internally as seven bytes. One byte each for year, month, day, hour minute, second and fraction of a second.
It's a space waster, but oh so fast to calculate with.
Timestamp on the other hand is stored as a floating point to save space.
|
|
|
|
 |
Internally, yes, if the engine expects it. But still no way to model a database.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
 |
You could try and merge DATE_CREATED and TIME_CREATED to get a DATETIME value then you could use between.
Something like (most likely will not work as written):
(Date_Created + Time_Created) BETWEEN @startdatetime AND @enddatetime
|
|
|
|
 |
As others have said, the time should be part of the DATE_CREATED column. However, it's still possible to get what you need:
WHERE
(DATE_CREATED = '20140902' And Convert(time, TIME_CREATED) >= '05:00:00')
Or
(DATE_CREATED = '20140903' And Convert(time, TIME_CREATED) <= '05:00:00')
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
Thank you so much for the help, my query is working fine now.
|
|
|
|
 |
That is great!
I get started down a path and do not think outside of that.
|
|
|
|
 |
I need to send an email from a stored procedure, I found I use msdb.sp_send_dbmail, can someone give a suggestion on how I can do it except calling this built-procedure in sql server? Thanks.
|
|
|
|
 |
I use sp_send_dbmail - I can't think of any other methods provided by sql server which will do this.
For security reasons I have the stored procedure, which runs this, within the msdb database as certain permissions, which I am unwilling to give to users, are needed to run this stored procedure.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
 |
The sproc is there to provide the functionality.
If it is there, and works, and you need such, why ask for "any" solution that excludes it? Why "except"?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
 |
You can always have a .NET program run the procedure taking data from it and email from the .NET program.
|
|
|
|
 |
Hi,
I need your advise please..
here is the detail:::
The employee contract can be definite (with expiry date) or indefinite (open without expiry date).
The employee contract will always have date of join
if the contract is definite then employee will have 30 days every year where the year is the period between the date of join and +365 days and the renewal is the same (from the renewal date and +365)
if the contract is indefinite then employee will have 30 days every year where the year is the period between the date of join it's every 365 days so the contract has not renewal but the employee will have 30 days annually.
for example, if indefinite and date of join is 1 April 2010 then every period from 1 April until 30 March will have 30 days for the employee
I want to calculate the leaves for the employee without having to keep a renew table so it will be calculated based on the leave date and the first date of join.
hope I explained it well...
Technology News @ www.JassimRahma.com
|
|
|
|
 |
so the data will be just one leave table with from and to indicating the leave period for every leave and the result will be
1 April - 31 March - [Total Taken Leaves] - [Total Remaining Leaves]
Technology News @ www.JassimRahma.com
|
|
|
|
|
 |
I have HTML content in string variable (from <html> to </html>) within store procedure. The html contains one table with 'n' number of rows and columns. Its my final output which i will publish in mail.
My need is : I want to workout on last column in this HTML, and highlight background with RED color whichever SLA missed (As my last column having date and want to highlight entries less than today's date)
How to achieve this. Please help.
|
|
|
|
 |
How about learning CSS? (or HTML...)
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Hello,
I'm looking for a free (or cheap) and simple tool to design a SQL database. I just would like to be able to generate the standard SQL from the tool.
What do you suggest?
|
|
|
|
 |