In the ss you will see errors returned in the SSMS Command Window from entries I tried to make. I have a lot to learn about SQL., but I apparently haven’t learned enough yet.
I need to modify a table I previously created in my database. I need to add a new column. I quickly discovered that this cannot be done using SSMS GUI facilities and for good reason. After searching and reading tutorials and watching some YT, I learned this has to be done through commands. I found that the command should look like
ALTER TABLE clanPEOPLE
ADD COLUMN peopleSpouseID nchar(10);
If I have that wrong, please point me to lessons I need to learn. I thought that I might have to select the database or the table before the instructions would work, but trying that also yielded ‘command xxxxx is not valid’ errors.
I first tried to add the column to the table using the SSMS GUI interface:
and quickly learned that this cannot be done and for good reason. I learned that such structure changes have to be done with SQL code. I looked for and found a Command Window in SSMS. Although I didn’t find specific instructions saying this could be used to enter commands, I inferred that it’s possible to do so. Having tried and failed, I suspect I guessed wrong about using it.
I’m certain that I will need to modify other tables and perhaps delete some. I need to learn how to use commands to do so. I am yet to find a tutorial that focuses on using SQL entries to modify and manage table structures. All that I’ve found teach the long list of other commands and qualifiers that are used to create queries, joins, etc. that relate to using data. At this point I need specifics on commands that manage structure of tables, not the data they contain.
Can anyone tell me what I’m doing wrong wrt to the SSMS Command Window? Is this the wrong place to enter SQL instructions? If so, where should I be entering them?
I’d also like to know if the instructions I used were correct. Do I have the syntax wrong? If the instructions were wrong, what should I have used?
I’m trying to learn so answers and pointers to tutorials will be very helpful.