473,657 Members | 2,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing default values

How can i change the default value of a column? I already have a column
named DateOfRental but I want to alter it so that it has default value
getdate()

Thanks
David

--
http://www.nintendo-europe.com/NOE/e...l&a=Prodigious
Jul 20 '05 #1
4 11120

"David Wright" <Da***@prodigio usuk.com> wrote in message
news:bt******** **@news8.svr.po l.co.uk...
How can i change the default value of a column? I already have a column
named DateOfRental but I want to alter it so that it has default value
getdate()

Thanks
David

--
http://www.nintendo-europe.com/NOE/e...l&a=Prodigious


1. Use sp_help to get the current name of the constraint

exec sp_help MyTable

2. Drop the constraint

alter table MyTable drop constraint <Constraint name goes here>

3. Add a new constraint

alter table t1 add constraint DFT_DateOfRenta l default getdate() for
DateOfRental

Simon
Jul 20 '05 #2
Will try that, thanks Simon

David

"Simon Hayes" <sq*@hayes.ch > wrote in message
news:3f******** **@news.bluewin .ch...

"David Wright" <Da***@prodigio usuk.com> wrote in message
news:bt******** **@news8.svr.po l.co.uk...
How can i change the default value of a column? I already have a column
named DateOfRental but I want to alter it so that it has default value
getdate()

Thanks
David

--

http://www.nintendo-europe.com/NOE/e...l&a=Prodigious


1. Use sp_help to get the current name of the constraint

exec sp_help MyTable

2. Drop the constraint

alter table MyTable drop constraint <Constraint name goes here>

3. Add a new constraint

alter table t1 add constraint DFT_DateOfRenta l default getdate() for
DateOfRental

Simon

Jul 20 '05 #3
How can i drop a constraint i never made though? its not in the list when i
try the SP_help :(

"Simon Hayes" <sq*@hayes.ch > wrote in message
news:3f******** **@news.bluewin .ch...

"David Wright" <Da***@prodigio usuk.com> wrote in message
news:bt******** **@news8.svr.po l.co.uk...
How can i change the default value of a column? I already have a column
named DateOfRental but I want to alter it so that it has default value
getdate()

Thanks
David

--

http://www.nintendo-europe.com/NOE/e...l&a=Prodigious


1. Use sp_help to get the current name of the constraint

exec sp_help MyTable

2. Drop the constraint

alter table MyTable drop constraint <Constraint name goes here>

3. Add a new constraint

alter table t1 add constraint DFT_DateOfRenta l default getdate() for
DateOfRental

Simon

Jul 20 '05 #4
David Wright (Da***@prodigio usuk.com) writes:
How can i drop a constraint i never made though? its not in the list
when i try the SP_help :(


If there is no constraint, you should not have to drop it.

--
Erland Sommarskog, SQL Server MVP, so****@algonet. se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
2686
by: Bo Peng | last post by:
Dear list, I have many dictionaries with the same set of keys and I would like to write a function to calculate something based on these values. For example, I have a = {'x':1, 'y':2} b = {'x':3, 'y':3} def fun(dict):
2
1916
by: Asp Help | last post by:
I'm working on a ASP applicatition to create Windows 2000 users. Because I don't want everybody to have access to the site I've changed te security in IIS 5.0 which runs on a windows 2000 Sp4 server: The security on the site is mainly anonymous. The anonymous account has been changed to an account which has the right permissions. The security on one asp page (GetUser.asp) is changed to only "Windows Integrated". A User that access the...
10
1625
by: Daniel | last post by:
how to make two references to one string that stay refered to the same string reguardless of the changing value in the string?
1
4095
by: Firewalker | last post by:
I am attempting to change the backColor property on the previously instantiated buttons FROM a listbox_doubleClick event. I thought it would be something like this: If Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.White) Then Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.CornflowerBlue) 'End If
7
4028
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value. However, at the moment I am just getting more gibberish so I'm probably doing something wrong. I tried using ASCII Encoding before to get the ASCII values. Although this worked for 0-127 ASCII values, extended ASCII gave strange values (such as 1992...
7
1598
by: Luongo | last post by:
Hi, I'm a beginner to Access so this question may seem pretty simple to some of you, but I could not seem to find an answer elsewhere on the web. I have a form which allows the user to select two variables - shift number and supervisor. When this form is submitted it opens another form, in which I would like the default values of fields 'Shift' and 'Supervisor' to be the variables entered in the original form. Therefore, the default values...
3
1149
by: Rodrigo Juarez | last post by:
Hi I have the next xml config file and I need to read and write key values, for example, change the value of hibernate.connection.connection_string <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections>
7
9271
by: Larry Neylon | last post by:
Hi there, We are in the process of implementing Membership and Role Management and have a problem with the connection strings in our web.config. We currently have a system that on Application_Start set the Application to the relevant ConnectionString from the web.config based upon the domain (so we can handle dev/test/live, etc). The problem we have is that we can't see how to dynamically set the
8
12596
by: peterkennett | last post by:
I am designing a database that will be used by many different offices, and each office may want to change the defaults I have in a table. Rather than teach each user how to go in and change a table's default values, I want to create a user-friendly form that allows them to change the default values in the linked table. Let's say I have a form field "office" on my form that is linked to the table field in my table. The field has a...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.