11.4. Change the user's password through SQL statements
To change someone else's, you need sysadmin role
EXEC sp_password NULL, 'newpassword', ' User'
If the account is SA, execute EXEC sp_password NULL, 'newpassword', sa
11.5. How to determine which fields of a table are not allowed to be empty?
select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where IS_NULLABLE='NO' and TABLE_NAME=tablename
11.6. How to find tables with the same fields in the database?
a. Check the known column name
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. Unknown column names check all column names that appear 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 the xxx row of data
Assume 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)
It is also possible if you use a cursor
fetch absolute [number] from [cursor_name]