Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Queries - Kristen - In plain English.

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2007-10-16 : 10:32:04
Good Morning Kristen:

Thank You, You are the first person, that has given me a clear answer. I am going to explain in plain English What this SP is suppose to do.

I have to find any station_nbr that has more than one group_code and that the current date = (DATEADD(mm,DATEDIFF(mm,0,dateadd(mm,-0-datepart(day,0),getdate())),0) The current date starts with the first day of the previous month.
Example today is October 10, 2007 I need September 01, 2007 for this query.
To insert the record it needs to be active meaning that the current date is in between Beg_eff_date and end_eff_date, and the end_eff_date is = ‘12/31/3000’


I need to write SP(cursor) that reads line by line this table and that insert the answer: INSERT INTO #TP_TIES_OVerlaping_Dates.

Example:
Current_date: 09/01/2007


Group_Code Station_nbr beg_eff_date end_eff_date
0000003 00371101 03/12/2006 12/31/3000
0000016 00371101 07/08/2007 12/31/3000


The above explanation is for the first type of Error.

The second Type of Error:
If the Group Code ends with "W" and the End_effective_date = '12/31/3000' and the W_Beg_date is Part of the Temp Table(I to create the W_Beg_Date Column) -- is GREATER than the End_eff_date. I want to Insert this Record into the Table. I need to set sometype of Record Control to make the different between one error to another one.

I thank you so much for your help.....I hope this is clear to understand for everybody.

End

Kristen
Test

22859 Posts

Posted - 2007-10-16 : 10:43:53
Do not post duplicate posts:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=91025#341844

folk will start answering one or the other and then get annoyed if they find someone else has already answered in another thread.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-16 : 10:51:32
Or is this Q-Bot inspired by K-Bot?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2007-10-16 : 11:16:56
Ok. I thought about starting clean. Maybe I will have better luck getting a clear answer, plus the post was intended for you, since you were the only one yesterday, that gave me a clear answer of how to find the Sept. 01, 2007 date. Everybody else saw the syntax error but no one corrected it.

Do you want to help me? Let me know,

Thanks!!!
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2007-10-16 : 11:18:18
The last post is intended for Kristen-
Kristen Please let me know, if you can help me.

Thanks!!!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-10-16 : 11:28:05
quote:
Originally posted by osirisa

The last post is intended for Kristen-
Kristen Please let me know, if you can help me.

Thanks!!!



You do know that Kristen's already married



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-10-16 : 12:48:09
And has a unit (most of the time, anyways)

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-16 : 13:07:04
Locking this duplicate thread.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -