SQL Server 2000 is depressing

Source: Internet
Author: User

It cannot be used in functions. getdate ()
For example:

Create   Function Gettoday
(
)
Returns   Datetime
As
Begin
Return   Convert ( Char ( 10 ), Getdate (), 120 )
End

The following error is reported:
Server: Message 443, level 16, status 1, process gettoday, Row 7
The 'getdate' is incorrectly used in the function '.
No way. You can only use the parameter to bring in getdate () Create   Function Gettoday
(
@ Now   Datetime
)
Returns   Datetime
As
Begin
Return   Convert ( Char ( 10 ), @ Now , 120 )
End

We recommend that you obtain the table records of all tables and the SQL statements that use space.

Exec Sp_msforeachtable
@ Precommand = N '
Create Table ##(
Id int identity,
Table Name sysname,
Number of fields int,
Number of records int,
Reserved space nvarchar (10 ),
Use space varchar (10 ),
Index space varchar (10 ),
Unused space varchar (10 )) ' ,
@ Command1 = N ' Insert ## (Table Name, number of records, reserved space, used space, index space, unused space) exec sp_spaceused '' ? ''
Update ## set field COUNT = (select count (*) from syscolumns where id = object_id ( '' ? '' ) Where id = scope_identity () ' ,
@ Postcommand = N ' Select * from # order by ID drop table ## '
Related Article

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.