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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 With values

Author  Topic 

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2004-07-20 : 05:51:54
Hi All,

I am creating trying to alter a table with a field. But my problem is, I am not able to create the field with "WITH VALUES" clause. Please if any body can help me.

Thanks in advance
Sachin

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-20 : 08:40:37
?????? Why don't you show us an example. I'm currently deep in the fog. I do see a light though, shining dimly in the distance.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-20 : 12:29:11
WITH VALUES? Huh? Is that from Enterprise Manager? Is this even SQL Server?

Tara
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-07-20 : 13:13:27
Maybe syntax problem ?
ALTER TABLE MyTab ADD MyCol char(5) NULL DEFAULT('MyVal') WITH VALUES

The WITH VALUES clause is only interesting when <I>Adding a Null Column</I> to the table.
You can use UPDATE as well

/rockmoose
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-07-20 : 14:18:47
what does WITH VALUES mean? is this T-SQL?

- Jeff
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-07-20 : 14:27:08
Doesn't anyone have BOL here ???
When adding a column(that allows nulls) with DEFAULT to a table.
Then WITH VALUES will fill in the default value for you.

/rockmoose
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-07-20 : 14:34:34
oh -- alter table only. got it. thanks

- Jeff
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-20 : 14:58:47
So let me get this right ...

You set up a new column. You put a DEFAULT on it. But you set it to ALLOW nulls. And you want the existing rows populated with the DEFAULT, rather than NULL.

I'm really struggling to think of an occassion when I would want to do this (but, naturally, I've stored the knowledge away in case it ever happens!) so a Real World example would be much appreciated.

Kristen
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-07-20 : 16:57:04
Dunno, never done it.
thinking thinking thinking.... nope not today...

/rockmoose

Go to Top of Page
   

- Advertisement -