1b33e Writing SQL code
Sign Up |  Live StatsLive Stats    Articles 37,345| Comments 177,357| Members 19,420, Newest Talia| Online 387
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags

Writing SQL code

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Writing on Water Soul_jyot Spiritual Articles 1 22-Jun-2007 21:15 PM
Writing help files DaBartman Information Technology 2 28-Jul-2006 08:42 AM
2 Questions: Code to exit via cmdExit; Code to hide/disable tool b AndyG Information Technology 5 28-Jul-2006 08:39 AM
Writing to Excel from VBA Jeremy S. Information Technology 1 28-Jul-2006 08:21 AM
The Sikh Story Writing Contest - get published, get prizes, get WRITING! Pogo Inspirational Stories 0 11-Dec-2005 06:05 AM


Tags
writing, sql, code
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:26 AM
blacklf's Avatar blacklf
Guest
 
Posts: n/a
   
   
Writing SQL code

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I am trying to automate a task for a user in MS Office Access 2003. I have
everything figured out except how to write an SQL statement to temporarily
disable a primary key. Does anyone know how to do this? I've read so much
material searching for the answer that my eyes are crossing!
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/12079-writing-sql-code.html

*







Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:26 AM
Wolfgang Kais's Avatar Wolfgang Kais
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

Hello "blacklf".
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079

"blacklf" wrote:
> I am trying to automate a task for a user in MS Office Access 2003.
> I have everything figured out except how to write an SQL statement
> to temporarily disable a primary key. Does anyone know how to do
> this? I've read so much material searching for the answer that my
> eyes are crossing!


You can't temporarily disable a primary key, you can delete it
(Drop Index [indexname] On [tablename])
and create a new one later
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
(Create Index [indexname] On [tablename] ([fieldname]) With Primary)
But:
Why would you delete a primary key? To be able to violate the
uniqueness of the values? You won't be able to create a primary
key afterwards!

--
Regards,
Wolfgang


Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:26 AM
pvdg42's Avatar pvdg42
Guest
 
Posts: n/a
   
   
Re: Writing SQL code


"blacklf" wrote in message
news:19E91829-C3FB-4474-BB47-B63DE8AB1174@microsoft.com...
>I am trying to automate a task for a user in MS Office Access 2003. I have
> everything figured out except how to write an SQL statement to temporarily
> disable a primary key. Does anyone know how to do this? I've read so
> much
> material searching for the answer that my eyes are crossing!

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079

Here's a reference for you,

http://office.microsoft.com/en-us/as...322071033.aspx
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079


Reply With Quote
  #4 (permalink)  
Old 28-Jul-2006, 08:26 AM
blacklf's Avatar blacklf
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

  Donate Today!  
Wolfgang,

Thanks for your reply. My user has a database that is used in 1 year
cycles. She wants to be able to clear the data and reset her autonumbers to
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
start over with 1 for the new year. I am trying to write the code so she can
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
accomplish this "with the push of a button."

I tried the code you sent me last week. I get a message that the index
cannot be dropped because it is used in a relationship. I guess what I
really need is a way to use code to remove a relationship.


"Wolfgang Kais" wrote:

> Hello "blacklf".
>
> "blacklf" wrote:
> > I am trying to automate a task for a user in MS Office Access 2003.
> > I have everything figured out except how to write an SQL statement
> > to temporarily disable a primary key. Does anyone know how to do
> > this? I've read so much material searching for the answer that my
> > eyes are crossing!

>
> You can't temporarily disable a primary key, you can delete it
> (Drop Index [indexname] On [tablename])
> and create a new one later
> (Create Index [indexname] On [tablename] ([fieldname]) With Primary)
> But:
> Why would you delete a primary key? To be able to violate the
> uniqueness of the values? You won't be able to create a primary
> key afterwards!
>
> --
> Regards,
> Wolfgang
>
>
>

Reply With Quote
  #5 (permalink)  
Old 28-Jul-2006, 08:26 AM
blacklf's Avatar blacklf
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

This is a good reference. Thanks. Will keep looking. Wolfgang brought to
my attention that what I really need is a way to delete a relationship with
code. When I try to drop the index I get a message that it can't be done
because the index is used in a relationship.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079

"pvdg42" wrote:

>
> "blacklf" wrote in message
> news:19E91829-C3FB-4474-BB47-B63DE8AB1174@microsoft.com...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> >I am trying to automate a task for a user in MS Office Access 2003. I have
> > everything figured out except how to write an SQL statement to temporarily
> > disable a primary key. Does anyone know how to do this? I've read so
> > much
> > material searching for the answer that my eyes are crossing!

>
> Here's a reference for you,
>
> http://office.microsoft.com/en-us/as...322071033.aspx
>
>
>

Reply With Quote
  #6 (permalink)  
Old 28-Jul-2006, 08:26 AM
pvdg42's Avatar pvdg42
Guest
 
Posts: n/a
   
   
Re: Writing SQL code


"blacklf" wrote in message
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
news:7A8FB376-3829-4632-842E-626183BCFAF6@microsoft.com...
> This is a good reference. Thanks. Will keep looking. Wolfgang brought
> to
> my attention that what I really need is a way to delete a relationship
> with
> code. When I try to drop the index I get a message that it can't be done
> because the index is used in a relationship.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
>

Actually, I was referring to the "DROP CONSTRAINT" part of the reference.
You may have to drop constraints, do whatever you want to do, then add the
constraints back.


Reply With Quote
  #7 (permalink)  
Old 28-Jul-2006, 08:26 AM
Bill Edwards's Avatar Bill Edwards
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

This is a bad use of autonumber.
Autonumber is meant to provide only a unique key value for a record. It is
not guaranteed to be sequential. When used properly, your users should not
care what the value of the autonumber field is -- in fact they should
probably not even see it.

Assuming you have created relationships and cascade delete is not enabled,
to reset the autonumber:
Delete all the records from the child tables
Delete all the records from the parent table
Compact and repair the database.

A better solution would to add a date field and a sequence number field to
the table. Then write code to increment the sequence number for a given
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
year.


"blacklf" wrote in message
news:C87FC2F1-73E4-453E-B03C-C05F1B236AFA@microsoft.com...
> Wolfgang,
>
> Thanks for your reply. My user has a database that is used in 1 year
> cycles. She wants to be able to clear the data and reset her autonumbers
> to
> start over with 1 for the new year. I am trying to write the code so she
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> can
> accomplish this "with the push of a button."
>
> I tried the code you sent me last week. I get a message that the index
> cannot be dropped because it is used in a relationship. I guess what I
> really need is a way to use code to remove a relationship.
>
>
> "Wolfgang Kais" wrote:
>
>> Hello "blacklf".
>>
>> "blacklf" wrote:
>> > I am trying to automate a task for a user in MS Office Access 2003.
>> > I have everything figured out except how to write an SQL statement
>> > to temporarily disable a primary key. Does anyone know how to do
>> > this? I've read so much material searching for the answer that my
>> > eyes are crossing!

>>
>> You can't temporarily disable a primary key, you can delete it
>> (Drop Index [indexname] On [tablename])
>> and create a new one later
>> (Create Index [indexname] On [tablename] ([fieldname]) With Primary)
>> But:
>> Why would you delete a primary key? To be able to violate the
>> uniqueness of the values? You won't be able to create a primary
>> key afterwards!
>>
>> --
>> Regards,
>> Wolfgang
>>
>>
>>



Reply With Quote
  #8 (permalink)  
Old 28-Jul-2006, 08:26 AM
blacklf's Avatar blacklf
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

Thanks, Bill. Point taken. I didn't create the database, but the user is
asking me to make it work the way she wants it to. Maybe I can talk her into
an alternate solution.

"Bill Edwards" wrote:

> This is a bad use of autonumber.
> Autonumber is meant to provide only a unique key value for a record. It is
> not guaranteed to be sequential. When used properly, your users should not
> care what the value of the autonumber field is -- in fact they should
> probably not even see it.
>
> Assuming you have created relationships and cascade delete is not enabled,
> to reset the autonumber:
> Delete all the records from the child tables
> Delete all the records from the parent table
> Compact and repair the database.
>
> A better solution would to add a date field and a sequence number field to
> the table. Then write code to increment the sequence number for a given
> year.
>
>
> "blacklf" wrote in message
> news:C87FC2F1-73E4-453E-B03C-C05F1B236AFA@microsoft.com...
> > Wolfgang,
> >
> > Thanks for your reply. My user has a database that is used in 1 year
> > cycles. She wants to be able to clear the data and reset her autonumbers
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> > to
> > start over with 1 for the new year. I am trying to write the code so she
> > can
> > accomplish this "with the push of a button."
> >
> > I tried the code you sent me last week. I get a message that the index
> > cannot be dropped because it is used in a relationship. I guess what I
> > really need is a way to use code to remove a relationship.
> >
> >
> > "Wolfgang Kais" wrote:
> >
> >> Hello "blacklf".
> >>
> >> "blacklf" wrote:
> >> > I am trying to automate a task for a user in MS Office Access 2003.
> >> > I have everything figured out except how to write an SQL statement
> >> > to temporarily disable a primary key. Does anyone know how to do
> >> > this? I've read so much material searching for the answer that my
> >> > eyes are crossing!
> >>
> >> You can't temporarily disable a primary key, you can delete it
> >> (Drop Index [indexname] On [tablename])
> >> and create a new one later
> >> (Create Index [indexname] On [tablename] ([fieldname]) With Primary)
> >> But:
> >> Why would you delete a primary key? To be able to violate the
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> >> uniqueness of the values? You won't be able to create a primary
> >> key afterwards!
> >>
> >> --
> >> Regards,
> >> Wolfgang
> >>
> >>
> >>

>
>
>

Reply With Quote
  #9 (permalink)  
Old 28-Jul-2006, 08:26 AM
blacklf's Avatar blacklf
Guest
 
Posts: n/a
   
   
Re: Writing SQL code

Thanks. I'll give that a try.

"pvdg42" wrote:

>
> "blacklf" wrote in message
> news:7A8FB376-3829-4632-842E-626183BCFAF6@microsoft.com...
> > This is a good reference. Thanks. Will keep looking. Wolfgang brought
> > to
> > my attention that what I really need is a way to delete a relationship
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> > with
> > code. When I try to drop the index I get a message that it can't be done
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12079
> > because the index is used in a relationship.
> >

> Actually, I was referring to the "DROP CONSTRAINT" part of the reference.
> You may have to drop constraints, do whatever you want to do, then add the
> constraints back.
>
>
>

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Woolwich Killing: The...
Today 07:42 AM
14 Replies, 157 Views
How does Sikhi help you...
Today 07:20 AM
43 Replies, 1,083 Views
US Congress panel passes...
Today 04:22 AM
0 Replies, 17 Views
Harmeet Kaur Took the...
Today 03:40 AM
0 Replies, 28 Views
Is Science a Religion?
Today 03:00 AM
10 Replies, 1,926 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:43 AM
319 Replies, 7,682 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 00:36 AM
182 Replies, 4,587 Views
Rochester Gurdwara...
Today 00:24 AM
1 Replies, 49 Views
Panjabi Alphabet Resource
Yesterday 23:15 PM
12 Replies, 6,555 Views
Transgenderism ... Right...
Yesterday 22:55 PM
30 Replies, 1,356 Views
Biography of a Scholar:...
Yesterday 22:53 PM
1 Replies, 55 Views
Dusting The Web
Yesterday 22:25 PM
0 Replies, 34 Views
How Pure the Tongue? New...
Yesterday 21:29 PM
0 Replies, 53 Views
Stockholm riots throw...
Yesterday 21:14 PM
1 Replies, 35 Views
Biography of a Scholar:...
Yesterday 18:59 PM
2 Replies, 167 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 07:48 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.56898 seconds with 32 queries
0