You need to make a class and past this method
server static void main(Args _args){ DictTable dictTable; Connection
connection; Statement statement; str sql; ResultSet
resultSet; SqlStatementExecutePermission perm; ; dictTable = new
DictTable(tableNum(ContactPerson)); if (dictTable != null) {
connection = new Connection(); sql = strfmt("SELECT Name,BirthDate
from "+ "ContactPerson where month(ContactPerson.BirthDate) =
month(GetDate()) and day"+ "(ContactPerson.BirthDate) =
day(GetDate())"); //Instantiate the permission class perm =
new SqlStatementExecutePermission(sql); //check for permission to use
statement perm.assert(); statement =
connection.createStatement(); resultSet =
statement.executeQuery(sql); //end the scope of the assert call
CodeAccessPermission::revertAssert(); while (resultSet.next())
{ print 'name = ' +resultSet.getString(1)+ '
Birthdate= '+resultSet.getString(2); } pause; }}
M Amir NazimSoftware Engineer MazikPakistan - Dynamics DivisionEmail : [EMAIL
PROTECTED]
To: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Fri, 2 Nov 2007 18:17:16
+0000Subject: [development-axapta] Re: How To Find Persons who born today ?
(birthdate)
The following code will find users who's month and day match today's month and
day. It runs a sql statement against the database. Good luck.Connection Con =
new Connection();Statement Stmt = Con.createStatement();ResultSet R =
Stmt.executeQuery("SELECT Name,BirthDate from EmplTable where
month(EmplTable.BirthDate) = month(GetDate()) and day(EmplTable.BirthDate) =
day(GetDate())");;while ( R.next() ){print R.getString(1);pause;}--- In
[email protected], "Max Belugin" <[EMAIL PROTECTED]> wrote:>>
Add month and day fields and index and update them when birthdate changes> > >
On 11/1/07, Ali Ãhsan Aðca <[EMAIL PROTECTED]> wrote:> > Thanks Steffen,> >
But I wrote wrong word in my reply message to Rosyee.> > Sufficient must be
efficient.> > I know that query will bring me the result but speed will not> >
be high as I wish.> > Because all the records will be checked if the person is
born today in> > code.> > But I want that case be checked by sql server not by
axapta.> > Glad to describe my problem to you. (If I could)...> >> > Best
Regards...> > Ali Ihsan> >> > --- In [email protected],
"Steffen Denize"> > <steffendenize@> wrote:> > >> > > Hi Ali> > >> > > If you
change emplTable to contactPerson in the select statement> > from Rosyee> > >
you will find all persons who have birthday today, no matter how> > many
person> > > there are in the given table.> > >> > >> > >> > > Best regards,> >
>> > > Steffen> > >> > >> > >> > > Fra: [email protected]> > >
[mailto:[EMAIL PROTECTED] PÃ¥ vegne af Ali Ãhsan Aðca> > > Sendt: 24. oktober
2007 12:52> > > Til: [email protected]> > > Emne:
[development-axapta] Re: How To Find Persons who born today ?> > > (birthdate)>
> >> > >> > >> > > Thanks Rosyee,> > > But I have to find persons from
ContactPerson table.> > > And there more than 200.000 records in there.> > >
And this method will not be sufficient for finding 5 or maybe max 10> > >
person from there.> > >> > > Best Regards...> > > --- In HYPERLINK> > >> >
"mailto:development-axapta%40yahoogroups.com"[EMAIL PROTECTED]> > > com, Rosyee
<rosyee@> wrote:> > > >> > > > Hi Ali,> > > >> > > > You can use like this> > >
>> > > > while Select emplTable> > > > {> > > > if(
mthofyr(emplTable.BirthDate) == mthofyr(today())> > > > &&
dayofmth(emplTable.BirthDate) == dayofmth(today()))> > > > {> > > > //u'll get
records who born on same day as today> > > > }> > > > }> > > >> > > > Hope this
is what you are looking for.> > > >> > > > Thanks,> > > > Rosyee> > > >> > > >>
> > > On 10/24/07, Max Belugin <mbelugin@> wrote:> > > > >> > > > > I'd prefer
to extract month and day numbers to separate fields.> > > > >> > > > > But you
can use Connection and native queries> > > > >> > > > > On 10/23/07, Ali Ãhsan
Aðca> > > <aliihsanagca@<aliihsanagca%40gmail.com>>> > > > > wrote:> > > > > >
I thought so. But I think there must be a way to include that> > > case in> > >
> > > query filter string> > > > > >> > > > > > Thanks...> > > > > >> > > > > >
--- In> > > HYPERLINK> > >> >
"mailto:development-axapta%40yahoogroups.com"[EMAIL PROTECTED]> > >
com<development-axapta%40yahoogroups.com>,> > > > > "Max Belugin"> > > > > >
<mbelugin@> wrote:> > > > > > >> > > > > > > I think, the only way is to
enumerate dates from today back to> > > 1900.> > > > > > > (AFAIK there is no
way to store dates prior to 1900)> > > > > > >> > > > > > > On 10/22/07, Ali
�hsan Aðca <aliihsanagca@> wrote:> > > > > > > > I want to find the
persons who were born today?> > > > > > > > What is the filter for that query?>
> > > > > > >> > > > > > > > Thanks in advance...> > > > > > > >> > > > > > >
>> > > > > > > >> > > > > > > >> > > > > > > > Yahoo! Groups Links> > > > > > >
>> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > >
> > > --> > > > > > > Max Belugin, HYPERLINK> >
"http://belugin.info"http://belugin.info ,> > > ICQ:9406811> > > > > > >> > > >
> >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > > Yahoo! Groups Links>
> > > > >> > > > > >> > > > > >> > > > > >> > > > >> > > > > --> > > > > Max
Belugin, HYPERLINK "http://belugin.info"http://belugin.info ,> > > ICQ:9406811>
> > > >> > > > >> > > >> > > >> > > > [Non-text portions of this message have
been removed]> > > >> > >> > >> > >> > >> > >> > > No virus found in this
incoming message.> > > Checked by AVG Free Edition.> > > Version: 7.5.503 /
Virus Database: 269.15.9/1090 - Release Date:> > 24-10-2007> > > 08:48> > >> >
>> > > No virus found in this outgoing message.> > > Checked by AVG Free
Edition.> > > Version: 7.5.503 / Virus Database: 269.15.9/1090 - Release Date:>
> 24-10-2007> > > 08:48> > >> > >> > >> > > [Non-text portions of this message
have been removed]> > >> >> >> >> >> >> > Yahoo! Groups Links> >> >> >> >> > >
-- > Max Belugin, http://belugin.info , ICQ:9406811>
_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook together at last. Get it
now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/development-axapta/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/