events

Technical Article

RE: variable tablename in cursor select stmt

  • Reply

What would be your max number of tables per @countyt? I'm thinking something in the line of (David's modified) declare @sql nvarchar(4000) set @sql = 'DECLARE cursor2 CURSOR GLOBALDYNAMIC FOR SELECT Convert(Int, 0) as SumOf_file_size_bytes , Convert(Char(x), NULL) as Lseries WHERE 1=2 -- Dummy to establish structure' + Char(13) + Char(10) Select @sql = @sql […]

You rated this post out of 5. Change rating

2003-12-19

1 reads

Technical Article

RE: variable tablename in cursor select stmt

  • Reply

The number of tables are about 150 now and the number of rows anywhere from 0 to a million in each table. The number of tables and rows can increase in future as they get updated once a week/2 weeks. The table name has to be obtained dynamically since the it put together as tblFilenames_XY […]

You rated this post out of 5. Change rating

2003-12-19

Technical Article

RE: Simplifying this select

  • Reply

Matt, I apologize again for the errors . Thanks for your patience. I hope I at least provided some things to help you and maybe others. Vacation is indeed long over due. It's to the point of "use it or lose it", which means I really need it. Hope I don't spend the entire vacation […]

You rated this post out of 5. Change rating

2003-12-19

Technical Article

RE: ORACLE !

  • Reply

I have had the pleasure to work extensively on Oracle and SQL Server and thought this thread was great!! Yes, Oracle DBA's are more protective and I think the SQL Server DBA's could learn something from them. I used to be in a mixed batch of 11 DBA's and we had some of the most […]

You rated this post out of 5. Change rating

2003-12-19

Technical Article

RE: Simplifying this select

  • Reply

Yes I noticed that, but I figured that out without your help. :] ALso your temp tables where messed up as well. Yes, you need a vacation. That gets me my data and got the right # of active_units. Only issue I see now, is I am only getting up to 2002 data no 2003 […]

You rated this post out of 5. Change rating

2003-12-19

Technical Article

RE: Simplifying this select

  • Reply

It's getting close to vacation time 🙂 so my typing is getting rough :(.... last post I had "is" misplelled as "id". Please correct... It's hard to test some of these things when you don't have the core source tables. I'll stick with you though.

You rated this post out of 5. Change rating

2003-12-19

Technical Article

RE: Simplifying this select

  • Reply

Let's try again... -- Make #EOMDates table If Object_ID('TempDB..#EOMDates') id Not NULL Drop Table #EOMDates Select * Into #EOMDates From ( Select Convert(DateTime, Convert(Varchar(8), DateAdd(m, 1-AMonth, DateAdd(yy, -ManyYears, GetDate())), 1)) - DatePart(d, GetDate()) As EndOfMonthDate From ( Select Number as AMonth From Master.dbo.spt_Values Where Type = 'P' and Number Between 1 and 12) Months Cross […]

You rated this post out of 5. Change rating

2003-12-19

1 reads

Technical Article

RE: Simplifying this select

  • Reply

Sorry Matt, I had the WHERE above the JOIN in my initial post... anyway, let's splitup the complexity... -- Make EOMDates table If Object_ID('TempDB..#EOMDates') id Not NULL Drop Table #EOMDates Select * Into #Temp From ( Select Convert(DateTime, Convert(Varchar(8), DateAdd(m, 1-AMonth, DateAdd(yy, -ManyYears, GetDate())), 1)) - DatePart(d, GetDate()) As EndOfMonthDate From ( Select Number as […]

You rated this post out of 5. Change rating

2003-12-19

1 reads

Technical Article

RE: Simplifying this select

  • Reply

Ahh I thought the first where statement was for the subquery and the 2nd where was for my original select, so I joined the 2 where's together and I am getting the same error message. ALso made a change to how I joined the tables together slightly. I also tried moving the On portion of […]

You rated this post out of 5. Change rating

2003-12-19

1 reads

Blogs

Small Data SF 2024

By

I can’t remember how I heard about Small Data SF 2024, but it caught...

A New Word: Moledro

By

moledro – n. a feeling of resonant connection with an author or artist you’ll...

Snowflake + Azure blob

By

Let’s go back to data platforms today and I want to talk about a...

Read the latest Blogs

Forums

7 sept, scheduled book

By philip.scott

Comments posted to this topic are about the item 7 sept, scheduled book

7 sept, schedlued article

By philip.scott

Comments posted to this topic are about the item 7 sept, schedlued article

6 sept, published book

By philip.scott

Comments posted to this topic are about the item 6 sept, published book

Visit the forum

Question of the Day

Azure Data Lake Storage Gen 2

Azure Data Lake Storage Gen 2 is built on ...?

See possible answers