How can we help you today? How can we help you today?

Why does SSMS reject all entered commands with a Command "xxx" is not valid. response?

I'm very very new to SQL Server.  I used it on a very limited basis a number of years ago to run some queries on a database created by someone else.  I learned only a smattering of query related commands.  I'm trying to create my own database for a small webpage backend.  I've created a local environment for creating and testing but my ultimate goal is to host everything at IONOS.  The local environment uses MS SQL Server and SSMS.  I've created a few simple tables as a way of learning.  

I want to become independent of the SSMS GUI and write scripts to run against my database.  At the moment, I'm working with DDL to get my table structures perfected.  I need to add a column to a table but ran into problems when I selected a column name, right clicked and chose the Insert option.  When I tried to close and save the table, I got an error saying that the Project couldn't be changed in that manner. After some searching and reading a tutorial or 2 later, I learned that I should be using scripting and that the syntax to use is "ALTER TABLE tablename ADD columnname (type);"

Not knowing any better I looked for and found the SSMS Command Window and and guessed that I could enter the command there to change my table.  That's when I encountered the rejection of everything I tried to enter as not being valid.

Granted, I have a great deal to learn.  FWIW I was a mainframe programmer in the days of punched card decks.  I'm learning a whole new toolset and set of languages.  It's been a slow crawl.

If anyone can set me straight given the information I've shared, I will be very grateful.  The ss shows my results:

ahraitch
0

Comments

1 comment

  • Christian Perez
    Official comment

    Hi ahraitch ,

    Thanks for reaching out to Redgate Support and sorry for the delay in my initial response. In this case what I would like you to do is double check we are running our queries from the correct interface window, so if you were to right-click on the dbo.clanPeople table in the Object Explorer and select the option “Select Top 1000 rows” and then reattempt to run 

     

    Alter TABLE dbo.ClanPEOPLE ADD peopleSpouseID Nchar(10);

     

    Is Alter still not recognized?

     

    Cheers,

     

    Christian Perez

    Product Support Engineer

    Christian Perez

Add comment

Please sign in to leave a comment.