11.4. Use SQL statements to change the user password
Sysadmin role is required to modify other users.
EXEC sp_password NULL, 'newpassword', 'user'
If the account is SA, execute EXEC sp_password NULL, 'newpassword', sa
11.5. How can I determine which fields in a table cannot be blank?
Select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where IS_NULLABLE = 'no' and TABLE_NAME = tablename
11.6. How can I find a table with the same fields in the database?
A. Query the names of known columns
SELECT B. name as TableName, a. name as columnname
From syscolumns a inner join sysobjects B
ON a. id = B. id
AND B. type = 'u'
AND a. name = 'Your field name'
B. Query all the names of unknown columns in different tables.
Select o. name As tablename, s1.name As columnname
From syscolumns s1, sysobjects o
Where s1.id = o. id
And o. type = 'u'
And Exists (
Select 1 From syscolumns s2
Where s1.name = s2.name
And s1.id <> s2.id
)
11.7. Query row xxx data
Assume that id is the primary key:
Select *
From (select top xxx * from yourtable) aa
Where not exists (select 1 from (select top xxx-1 * from yourtable) bb where aa. id = bb. id)
You can also use a cursor.
Fetch absolute [number] from [cursor_name]