473,467 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Create 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 11108

"David Wright" <Da***@prodigiousuk.com> wrote in message
news:bt**********@news8.svr.pol.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_DateOfRental 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***@prodigiousuk.com> wrote in message
news:bt**********@news8.svr.pol.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_DateOfRental 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***@prodigiousuk.com> wrote in message
news:bt**********@news8.svr.pol.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_DateOfRental default getdate() for
DateOfRental

Simon

Jul 20 '05 #4
David Wright (Da***@prodigiousuk.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
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 =...
2
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...
10
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
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...
7
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....
7
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...
3
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" ?> ...
7
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...
8
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.