House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  SQL

Alter column problem

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Alter column problem

Thanks for the help Bruce, Rodney S Mr CTR USA AMC 09/04/2007 02:21 PM
Sorry, wrong url.  Here is a correct one: Maya Tulchinsky 09/04/2007 02:19 PM
Here is url: Maya Tulchinsky 09/04/2007 02:14 PM
Yes,  That worked Bruce, Rodney S Mr CTR USA AMC 09/04/2007 01:39 PM
ALTER TABLE Contact_tbl add default 'dddddd' for FirstName Maya Tulchinsky 09/04/2007 01:23 PM
Thanks for suggection, but it didn't work either. Bruce, Rodney S Mr CTR USA AMC 09/04/2007 12:05 PM
Try this: Maya Tulchinsky 09/02/2007 07:58 PM
That's my understanding of [] also, but I don't think they hurt (in most Bruce, Rodney S Mr CTR USA AMC 08/30/2007 06:16 PM
Aren't the [brackets] just for when names have spaces or are keywords? Peter Boughton 08/30/2007 06:03 PM
Silly me I thought this would be a simple thing to do. Bruce, Rodney S Mr CTR USA AMC 08/30/2007 05:03 PM

09/04/2007 02:21 PM
Author: Bruce, Rodney S Mr CTR USA AMC Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2944 Thanks for the help Here is url: http://msdn2.microsoft.com/en-US/library/aa237859(sql.80).aspx Maya
09/04/2007 02:19 PM
Author: Maya Tulchinsky Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2943 Sorry, wrong url.  Here is a correct one: http://www.akadia.com/services/sqlsrv_table_auditing.html Maya "Bruce, Rodney S Mr CTR USA AMC" <rodney.s.bruce1@us.army.mil> wrote: Yes,   That worked Were did you find the syntex? I always seem to find: ALTER [COLUMN] column_name SET default_expr alters the default value for the column. As examples Thanks Rodney ALTER TABLE Contact_tbl add default 'dddddd' for FirstName Tested and it should work if you currently don't have any defaults for this column. Maya "Bruce, Rodney S Mr CTR USA AMC"  wrote:   Thanks for suggection, but it didn't work either. Removing COLUMN changed the error message to: Msg 170, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName '. The ";" doesn't seem to make a difference either way. Thanks Rodney Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya
09/04/2007 02:14 PM
Author: Maya Tulchinsky Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2942 Here is url: http://msdn2.microsoft.com/en-US/library/aa237859(sql.80).aspx Maya "Bruce, Rodney S Mr CTR USA AMC" <rodney.s.bruce1@us.army.mil> wrote: Yes,   That worked Were did you find the syntex? I always seem to find: ALTER [COLUMN] column_name SET default_expr alters the default value for the column. As examples Thanks Rodney ALTER TABLE Contact_tbl add default 'dddddd' for FirstName Tested and it should work if you currently don't have any defaults for this column. Maya "Bruce, Rodney S Mr CTR USA AMC"  wrote:   Thanks for suggection, but it didn't work either. Removing COLUMN changed the error message to: Msg 170, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName '. The ";" doesn't seem to make a difference either way. Thanks Rodney Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya
09/04/2007 01:39 PM
Author: Bruce, Rodney S Mr CTR USA AMC Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2941 Yes,  That worked Were did you find the syntex? I always seem to find: ALTER [COLUMN] column_name SET default_expr alters the default value for the column. As examples Thanks Rodney ALTER TABLE Contact_tbl add default 'dddddd' for FirstName Tested and it should work if you currently don't have any defaults for this column. Maya "Bruce, Rodney S Mr CTR USA AMC" <rodney.s.bruce1@us.army.mil> wrote:   Thanks for suggection, but it didn't work either. Removing COLUMN changed the error message to: Msg 170, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName '. The ";" doesn't seem to make a difference either way. Thanks Rodney Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya
09/04/2007 01:23 PM
Author: Maya Tulchinsky Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2940 ALTER TABLE Contact_tbl add default 'dddddd' for FirstName Tested and it should work if you currently don't have any defaults for this column. Maya "Bruce, Rodney S Mr CTR USA AMC" <rodney.s.bruce1@us.army.mil> wrote:   Thanks for suggection, but it didn't work either. Removing COLUMN changed the error message to: Msg 170, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName '. The ";" doesn't seem to make a difference either way. Thanks Rodney Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya
09/04/2007 12:05 PM
Author: Bruce, Rodney S Mr CTR USA AMC Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2939 Thanks for suggection, but it didn't work either. Removing COLUMN changed the error message to: Msg 170, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName '. The ";" doesn't seem to make a difference either way. Thanks Rodney Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya
09/02/2007 07:58 PM
Author: Maya Tulchinsky Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2935 Try this: ALTER TABLE  [dbo].[Contact_tbl] ALTER FirstName SET DEFAULT 'dddddd'; Hope this helps, Maya "Bruce, Rodney S Mr CTR USA AMC" <rodney.s.bruce1@us.army.mil> wrote: Silly me I thought this would be a simple thing to do. I want to set defaults for some fields using a stored procedure. My testing SP looks like: ------------SP Code------------------------ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE SPTemp AS BEGIN ALTER TABLE [dbo].[Contact_tbl] ALTER COLUMN FirstName DEFAULT 'dddddd' END GO ---------------------------------------------- I have tried veriations with and without [] around field name, with and without SET These are the errors I am getting: Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'DEFAULT'. Using SET: ALTER TABLE [dbo].[Contact_tbl] ALTER COLUMN [FirstName] SET DEFAULT 'dddddd' Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'SET'. Example from http://technet.microsoft.com/en-us/library/ms174123.aspx ALTER TABLE MyCustomers ALTER COLUMN CompanyName SET DEFAULT 'A. Datum Corporation' Thanks for any help Rodney
08/30/2007 06:16 PM
Author: Bruce, Rodney S Mr CTR USA AMC Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2934 That's my understanding of [] also, but I don't think they hurt (in most cases) if used when not needed And I was tring any veriation I could think of. Nope it don't like Modify either. ALTER TABLE [dbo].[Contact_tbl] MODIFY [FirstName] SET DEFAULT 'dddddd' GETS: Msg 102, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'FirstName'. ALTER TABLE [dbo].[Contact_tbl] MODIFY FirstName SET DEFAULT 'dddddd' GETS: Msg 102, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'MODIFY'. So there the [] make a difference, just not sure what or why. Thanks for the suggestion. Rodney Aren't the [brackets] just for when names have spaces or are keywords? Anyway, the syntax looks okay against that example... maybe try something like this: ALTER TABLE Contact_tbl MODIFY FirstName VARCHAR(50) DEFAULT 'dddddd' ?
08/30/2007 06:03 PM
Author: Peter Boughton Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2933 Aren't the [brackets] just for when names have spaces or are keywords? Anyway, the syntax looks okay against that example... maybe try something like this: ALTER TABLE Contact_tbl MODIFY FirstName VARCHAR(50) DEFAULT 'dddddd' ? ----- Excess quoted text cut - see Original Post for more -----
08/30/2007 05:03 PM
Author: Bruce, Rodney S Mr CTR USA AMC Short Link: http://www.houseoffusion.com/groups/sql/thread.cfm/threadid:800#2932 Silly me I thought this would be a simple thing to do. I want to set defaults for some fields using a stored procedure. My testing SP looks like: ------------SP Code------------------------ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE SPTemp    AS BEGIN ALTER TABLE [dbo].[Contact_tbl] ALTER COLUMN FirstName DEFAULT 'dddddd' END GO ---------------------------------------------- I have tried veriations with and without [] around field name, with and without SET These are the errors I am getting: Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'DEFAULT'. Using SET: ALTER TABLE [dbo].[Contact_tbl] ALTER COLUMN [FirstName] SET DEFAULT 'dddddd' Msg 156, Level 15, State 1, Procedure SPTemp, Line 8 Incorrect syntax near the keyword 'SET'. Example from http://technet.microsoft.com/en-us/library/ms174123.aspx ALTER TABLE MyCustomers ALTER COLUMN CompanyName SET DEFAULT 'A. Datum Corporation' Thanks for any help Rodney
<< Previous Thread Today's Threads Next Thread >>

Search sql

May 25, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference