All queries are showing red underlines

GreenerJay 41 Reputation points
2021-06-21T15:19:21.867+00:00

Hello

I am using SQL Server 2019 with SSMS 18.7. When I right click the servername or database and select "New Query", most query commands I type are underlined in Red. I am a SYSAdmin and am simply trying to enter the following commands:

ALTER DATABASE 'dbname'
SET RECOVERY SIMPLE
GO

Everything generates a syntax error. I feel like I am missing something very simple/obvious but I don't know what it is.

Thanks

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,665 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Cooper 8,471 Reputation points
    2021-06-21T15:26:59.057+00:00

    Don't use quotes, use brackets, that is
    ALTER DATABASE [dbname]

    Tom

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Mas 1 Reputation point
    2022-11-19T02:36:25.47+00:00

    Can anyone tell me when I run this nothing happens?

    CREATE TABLE movie_data (
    id SERIAL
    Movie VARCHAR (100),
    Title VARCHAR (100),
    Release_date VARCHAR (100),
    Wikipedia_URL VARCHAR (100),
    Genre VARCHAR (50),
    Director VARCHAR (50),
    Cast_1 VARCHAR (100),
    Cast_2 VARCHAR (100),
    Cast_3 VARCHAR (100),
    Cast_4 VARCHAR (100),
    Cat_5 VARCHAR (100),
    Budget MONEY (50),
    Revenue MONEY (50),
    Primary Key (id)
    )

    0 comments No comments

  2. Tom Cooper 8,471 Reputation points
    2022-11-19T04:26:25.81+00:00

    This is a Microsoft SQL Server forum. If you are using a different database you should ask your question on a forum for that database.
    If you are using SQL Server, then SERIAL is not a valid datatype and the MONEY datatype cannot specify as length. So in SQL Server you would probably want something like

    CREATE TABLE movie_data (  
    id INT identity,  
    Movie VARCHAR (100),  
    Title VARCHAR (100),  
    Release_date VARCHAR (100),  
    Wikipedia_URL VARCHAR (100),  
    Genre VARCHAR (50),  
    Director VARCHAR (50),  
    Cast_1 VARCHAR (100),  
    Cast_2 VARCHAR (100),  
    Cast_3 VARCHAR (100),  
    Cast_4 VARCHAR (100),  
    Cat_5 VARCHAR (100),  
    Budget MONEY,  
    Revenue MONEY,  
    Primary Key (id)  
    )  
      
    

    Tom
    P.S. Please don't ask new questions on an old thread. Create a new thread for your questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.