Extremely Serious

Category: Database (Page 2 of 2)

Using Values as the Record Source for Select Statement

Values can become a valid record source for select statement if the values has table alias and column names as follows:

SELECT dummy_table.* 
FROM (VALUES ('record1'),
	 ('record2'),
	 ('record3'),
	 ('record4'),
	 ('record5'),
	 ('record6'),
	 ('record7'),
	 ('record8'),
	 ('record9')) dummy_table (column1)

From the preceding select statement, the dummy_table is the table alias and the column name is column1.

Resetting sa password in SQL Server Express

  1. Open the Services application and look for SQL Server (SQLEXPRESS).
  2. Stop the SQL Server (SQLExpress) service.
  3. Right-click the SQL Server (SQLExpress) service and select Properties.
  4. At the Start parameters field type in -m.
  5. Click the Start button.
  6. Close the Services application.
  7. Open a Command Prompt in elevated mode.
  8. Execute the following command:
    osql -S <LOCAL_PC_NAME>\SQLEXPRESS -E

    Note: The <LOCAL_PC_NAME> must be changed appropriately.

  9. At the prompt generated by the previous command invoke the following commands in sequence:
    sp_password NULL,'<NEW_PASSWORD>','sa'

    Note: Change <NEW_PASSWORD> to your desired password.

    go
    quit
  10. Close the  elevated Command Prompt.
  11. Repeat steps 1 to 6, but on step 4 remove -m  from the Start parameters field, if it exists.
Newer posts »