Click here to Skip to main content
15,902,829 members
Home / Discussions / Database
   

Database

 
AnswerRe: stored procedure for restore .bak file Pin
Vimalsoft(Pty) Ltd22-Dec-09 2:26
professionalVimalsoft(Pty) Ltd22-Dec-09 2:26 
QuestionHelp building Trigger for updating summary table [modified] Pin
MAW3021-Dec-09 11:29
MAW3021-Dec-09 11:29 
AnswerRe: Help building Trigger for updating summary table Pin
Mycroft Holmes21-Dec-09 23:56
professionalMycroft Holmes21-Dec-09 23:56 
Questiontransaction error Pin
ademsandeepreddy20-Dec-09 19:53
ademsandeepreddy20-Dec-09 19:53 
AnswerRe: transaction error Pin
Member 450194023-Dec-09 7:31
Member 450194023-Dec-09 7:31 
QuestionNeed help with creating dynamic SQL statement Pin
James Shao20-Dec-09 17:54
James Shao20-Dec-09 17:54 
AnswerRe: Need help with creating dynamic SQL statement Pin
Mycroft Holmes21-Dec-09 11:00
professionalMycroft Holmes21-Dec-09 11:00 
QuestionNeed help with DATEDIFF function Pin
James Shao20-Dec-09 17:29
James Shao20-Dec-09 17:29 
I have a stock time series data in which a numerical indicator fluctuates over time. If I want to find out for each stock that has its indicator now over 30, how many days since the last time this indicator is less than 30?

In other words, how many days since the last time the stock's indicator crosses above 30?

Just for your reference, currently I have the following:

SELECT ticker,
DATEDIFF(d,(SELECT MAX(DATE) FROM....),'12/21/2009')
WHERE Indicator > 30 AND Date = '12/21/2009'

I'd greatly appreciate any help! Smile | :) If possible please provide a sample code.

By the way, thank you Ashfield for your help on a similar question last time, later I was able to understand the code you gave me and utilized it in different ways. This is a bit more difficult for me though.

modified on Monday, December 21, 2009 12:06 AM

AnswerRe: Need help with DATEDIFF function Pin
Ashfield21-Dec-09 0:27
Ashfield21-Dec-09 0:27 
GeneralRe: Need help with DATEDIFF function Pin
James Shao21-Dec-09 13:33
James Shao21-Dec-09 13:33 
Questioncannot excute script Pin
#Jet19-Dec-09 16:17
#Jet19-Dec-09 16:17 
AnswerRe: cannot excute script Pin
Eddy Vluggen20-Dec-09 0:08
professionalEddy Vluggen20-Dec-09 0:08 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 7:37
#Jet20-Dec-09 7:37 
GeneralRe: cannot excute script Pin
Mycroft Holmes20-Dec-09 12:14
professionalMycroft Holmes20-Dec-09 12:14 
GeneralRe: cannot excute script Pin
#Jet20-Dec-09 12:52
#Jet20-Dec-09 12:52 
QuestionDistributed DB Pin
piotr.zielinski19-Dec-09 7:55
piotr.zielinski19-Dec-09 7:55 
AnswerRe: Distributed DB Pin
Eddy Vluggen19-Dec-09 10:20
professionalEddy Vluggen19-Dec-09 10:20 
GeneralRe: Distributed DB Pin
piotr.zielinski19-Dec-09 10:24
piotr.zielinski19-Dec-09 10:24 
GeneralRe: Distributed DB Pin
Eddy Vluggen19-Dec-09 10:56
professionalEddy Vluggen19-Dec-09 10:56 
QuestionHow do I make a transaction an "atomic" operation? (SQL Server 2005) [modified] Pin
Xiangyang Liu 刘向阳18-Dec-09 2:28
Xiangyang Liu 刘向阳18-Dec-09 2:28 
AnswerRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Chris Meech18-Dec-09 2:46
Chris Meech18-Dec-09 2:46 
GeneralRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Xiangyang Liu 刘向阳18-Dec-09 3:04
Xiangyang Liu 刘向阳18-Dec-09 3:04 
QuestionRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Chris Meech18-Dec-09 3:26
Chris Meech18-Dec-09 3:26 
AnswerRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Xiangyang Liu 刘向阳18-Dec-09 3:30
Xiangyang Liu 刘向阳18-Dec-09 3:30 
GeneralRe: How do I make a transaction an "atomic" operation? (SQL Server 2005) Pin
Luc Pattyn18-Dec-09 6:33
sitebuilderLuc Pattyn18-Dec-09 6:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.