MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMS SQL Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2012, 05:06 AM
Berrern Berrern is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 1 Berrern User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 29 sec
Reputation Power: 0
MS Query error - due to length?

Hi,

I am trying to insert a calculated field into the SQL code of one of my queries (it's a simple query; just retrieving rows of invoices from an Excel sheet). This field is basically a bunch of nested IIF arguments, which calculates the age of each invoice.

The non-nested SQL code looks like this:

Code:
IIf(Month(`Invoice Date`)>Month(Monthend),'Future',)
(IIf(Month(`Invoice Date`)=Month(Monthend),'A.Current',))
(IIf((Month(`Invoice Date`)+1)=Month(Monthend),'B.31-60',))
(IIf((Month(`Invoice Date`)+2)=Month(Monthend),'C.61-90',))
(IIf((Month(`Invoice Date`)+3)=Month(Monthend),'D.91-120',))
(IIf((Month(`Invoice Date`)+4)=Month(Monthend),'E.121-150',))
(IIf((Month(`Invoice Date`)+5)=Month(Monthend),'F.151-180',))
(IIf((Month(`Invoice Date`)+6)=Month(Monthend),'G.181-210',))
(IIf((Month(`Invoice Date`)+7)=Month(Monthend),'H.211-240',))
(IIf((Month(`Invoice Date`)+8)=Month(Monthend),'I.241-270',))
(IIf((Month(`Invoice Date`)+9)=Month(Monthend),'J.271-300',))
(IIf((Month(`Invoice Date`)+10)=Month(Monthend),'K.301-330',))
(IIf((Month(`Invoice Date`)+11)=Month(Monthend),'L.331-1Y',))
(IIf((Month(`Invoice Date`)+12)<=Month(Monthend),'M.>1Y'))


Now, when nesting these together, and adding it to the SQL code in MS Query, it works fine up until the '211-240' row. When I nest in the next row, I get the following error:
http://www.stormskritt.com/msq1.jpg
(EDIT: As I'm a new user, I'm not allowed to link in images or URL's. The error I'm getting reads: "Incorrect column expression:").

This leads me to believe that there is some sort of length or # of character limit when it comes to these SQL statements.

I'm completely new to MS Query, but have quite a bit of experience in BRIO/Hyperion (which for various reasons I can't use anymore).

Any help would be greatly appreciated.

Thanks in advance,
Andreas

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsDatabasesMS SQL Development > MS Query error - due to length?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap