This website was initially designed to share my personal stuffs. However,while
surfing on the net, I found many false derogatory and cheap remarks against Hinduism.
Being well versed in indian scriptures,I decided to include spiritual stuffs just
for spreading awareness. Though my articles are focussed on hinduism, there would
be no offensive or defamatory content against any religion. Respecting all gods
is the essence of hinduism. This is a non profitable website and is not affiliated
or associated with any religious organizations.
Top Liked Articles
1. Why we cannot see god
2. Science in Hinduism-Gravitational force and repulsive force
3. Does God exists everywhere
4. Is Goddess Durga the supreme universal mother
5. Science in Hinduism-Einstein Theory of relativity
6. Why hanuman is the only savior of this age- kaliyuga
7. Science in hinduism-Evolution in vishnu avatars
8. Science in Hinduism-Structure of universe and various planets
9. Why humans are naturally herbivorous
10. Proof of Lord krishna existence-1
11. Vedas Quotes Against Present Caste System
12. Science in hinduism-Extraction-Contraction and creation of universe
13. Stories of radha krishna love
14. Legend of Ramayana across the world
15. Why scientists want to protect ram setu
16. Swastika-Most sacred symbol of all ancient civilization
17. Why gayatri mantra is the most powerful mantra
18. Historic examples against present caste based system
19. Why lord shiva is known as king of dance
20. Science in Hinduism-Large numbers and infinity
SubmitLinkURL Web Directory
|
Janani Janma-bhoomi-scha Swargadapi Gariyasi(Mother and Motherland are Greater than Heaven')-Lord Rama
Home→Blogs→
 Display any content
here, from text, images, to rich HTML. Use the close link to dismiss the box. Click
the close box to dismiss it.
Change structures-constraints of table using alter command
Posted By
admin on
Jul 14, 2012
165 Views
Latest
Hinduism news
You many be probably aware of the various altercation we can do using alter statements. However, I observed that many developers are not aware of the simple, yet powerful feature of alter statement. In this article, I have encapsulated almost all functionalities of alter statement. The ALTER TABLE statement allows you to rename an existing table. It can also be used to add, modify, or drop a column from an existing table. It also allows reassigning partitions, or disabling or enabling constraints and triggers. Alter table: Change the size or data type of the column Alter table UserInfo alter column UserName varchar(40) Where UserInfo is the tablename UserName is the column name whose datatype you want to change to varchar(40) Unlike oracle, sql server does not allow you to modify datatype or size of two or more columns in a single sql statement. You have to either recretae the table or write two statement to change datatype of columns in single statement. Alter table: Drop two columns in one statement alter table Subscriptions drop column [Description], [Version] Where Subscriptions is the tablename Description and version are two columns of table you wanna drop Add 'check' constraint to it alter table UserRole add constraint ck_roles check (roletype in ('Admin', 'User', 'Anonymous')); Where UserRole is the tablename ck_roles is the Constraint name roletype column name on which you want to apply list of roles Alter table to add a primary key alter table UserRole add constraint pk_Roles primary key(RoleId) Where UserRole is the tablename pk_Roles is the Constraint name RoleId column name which you want as primary key Alter table to add a foreign key with condition ON DELETE SET NULL ALTER TABLE products add CONSTRAINT fk_supplier FOREIGN KEY (supplier_id, supplier_name) REFERENCES supplier(supplier_id, supplier_name) ON DELETE SET NULL; Where products is the tablename fk_supplier is the foreign key Constraint name supplier_id, supplier_name list of column names which should have reference to column of another table supplier- name of the referenced table Use alter table to add foreign key with condition cascade delete ALTER TABLE products add CONSTRAINT fk_supplier FOREIGN KEY (supplier_id) REFERENCES supplier(supplier_id) ON DELETE CASCADE; Where products is the tablename fk_supplier is the foreign key Constraint name supplier_id column name which should have reference to column of another table supplier- name of the referenced table Alter table to rename column The script for renaming any column: sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN' Ex: sp_RENAME 'products.[productsid]' , '[productid]', 'COLUMN' The script for renaming any object (table, sp etc) sp_RENAME '[OldTableName]', '[NewTableName]' Ex: sp_RENAME '[products]', '[product]' Mark constraint with nocheck when creating a constraint ALTER TABLE Customers WITH NOCHECK ADD CONSTRAINT CN_CustomerPhoneNo CHECK (Phone LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]') Where Customers is the tablename CN_CustomerPhoneNo is the foreign key Constraint name Phone column name which should have phone number pattern as described in the statement
PDF
files are not generated for latest articles.
Tags:
Alter,Sql,Table,Constraints,Columns,Delete,Roles
Share this to your friends. One of your friend is waiting for your share.
All content of this website(Except Blogs) is handled by an automated process and is subjected to errors.
|
Good Thoughts
Don't spend your life with someone you can live with - spend it with someone you can't live without.
-Anon
Top Viewed Articles
1. Floating stones of Shri Ram Setu
2. Scientific explanation of Hindu cosmology and reincarnation
3. Is god female-Yes or No
4. How many Gods in Hinduism
5. Why all gods are born in india
6. Why Hindus greet namaste and its significance
7. Is lord ganesha God and worthy of worship
8. Science in Hinduism-Motion of earth around sun
9. Why cow is sacred to hindus
10. Science in Hinduism-Place value and Decimal number system
11. Why Idol worship in hinduism
12. Symbolism of story behind kumbh mela-world largest gathering on earth
13. Why Lord krishna had more than 16000 wives
14. Proving historicity of Krishna-Archaeological and astronomical evidences
15. Cheating and Deception by lord krishna
16. Why Animal worship in hinduism
17. Did Greeks worshipped lord krishna
18. Who invented snakes and ladders
19. Did Egyptians worshipped lord krishna
20. is Lord Kuber indian santa claus
|