You are here: Re: I want to parse @ArrayOfDays into @d1 through @d5 « MsSQL Server « IT news, forums, messages
Re: I want to parse @ArrayOfDays into @d1 through @d5

Posted by bobc on 09/29/07 02:05

On Sep 28, 8:52 pm, --CELKO-- <jcelko...@earthlink.net> wrote:
> >> In my stored procedure, I want to parse @ArrayOfDays into @d1 through @d5 .. execute a dynamically built SELECT. <<
>
> You are doing almost everything wrong. SQL does not work this way.
> Just pass a simple five parameter list. Then clean up your data in the
> procedure body. Try this for a skeleton
>
> CREATE PROCEDURE Foobar
> (@d1 INTEGER, @d2 INTEGER, @d3 INTEGER, @d4 INTEGER, @d5 INTEGER)
> AS
> SELECT ..
> FROM Floob
> WHERE Floob.x IN (@d1, @d2, @d3, @d4, @d5)
> AND ..;
>
> YOU can use COALESCE in the IN() list to handle NULLs or whatever.

Thanks, all. Both posts (yesterday and today) have been part of my
experiments to find the most efficient method of querying a ton of
data a ton of different ways to populate a "dashboard" page on
our .net intranet. You've both discovered that I am more an
applications programmer than a sql programmer, so I know you'll
forgive me. Meanwhile, your input has been very helpful. Thanks for
your time. -BobC

ps: es, the output string "array" was intended to be parsed by my
vb.net app. I just got a little curious about how arrays could be
implemented in t-sql, and possibly save some calls to the db server by
my app, or at least reduce the number of batches. I'm sure it's all
been done before, but I had to try and fail for myself. A learning
experience if nothing else. Thanks again.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация