Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Some basic doubts

Author  Topic 

rahulpnath
Starting Member

2 Posts

Posted - 2007-10-09 : 02:49:26
Hi,
I am totally new to sql server and have got a few doubts.I couldnt find it in earlier posts.Sorry if it is a repetition

*Can we get all the table names of a database by Query?
*How to create a similar copy of a table by using AS..does this work in sql server 2000?(tried but showing error)
*can we modify the column properties(like ensuring NOT NULL) after the table is created?


Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-09 : 03:06:16
1) Yes
2) Yes
3) Yes



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-09 : 03:08:57
Oh!? You want solutions too?

1) SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
2) SELECT * INTO TableCopy FROM TabelSource
3) ALTER TABLE ALTER COLUMN Col1 INT NOT NULL (probably with nocheck option set)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-09 : 03:49:47
I did the NOCHECK thing once. Another colleague looked at the Schema and wrote an Inner Join assuming there were no NULLs

Better to set them to something first if you really don't want NULLs in that column any more.

Discuss!

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-09 : 05:15:15
quote:
Originally posted by Peso

Oh!? You want solutions too?

1) SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
2) SELECT * INTO TableCopy FROM TabelSource
3) ALTER TABLE TABLE_NAME ALTER COLUMN Col1 INT NOT NULL (probably with nocheck option set)



E 12°55'05.25"
N 56°04'39.16"




Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rahulpnath
Starting Member

2 Posts

Posted - 2007-10-09 : 12:17:24
thank you.......
Go to Top of Page
   

- Advertisement -