MySQL (c api) VC instance and Code Download (1) (5)

Source: Internet
Author: User


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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.