How can I find authors with the same last name?
You can use the table authors in datatabase pubs. I want to get the result as below: Output:
?程序代码
au_lname???????????????????????????????? number_dups
---------------------------------------- -----------
Ringer?????????????????????????????????? 2
(1 row(s) affected)
Answer 3
select au_lname,number_dups=count(1) from authors group by au_lname
Question4:Can you create a cross-tab report in my SQL Server!
How can I get the report about sale quality for each store and each quarter and the total sale quality for each quarter at year 1993?
You can use the table sales and stores in datatabase pubs.
Table Sales record all sale detail item for each store. Column store_id is the id of each store, ord_date is the order date of each sale item, and column qty is the sale qulity. Table stores record all store information.
I want to get the result look like as below:
Output:
?程序代码
stor_name??????????????????????????????? Total?????? Qtr1??????? Qtr2??????? Qtr3??????? Qtr4???????
---------------------------------------- ----------- ----------- ----------- ----------- -----------
Barnum's???????????????????????????????? 50????????? 0?????????? 50????????? 0?????????? 0
Bookbeat???????????????????????????????? 55????????? 25????????? 30????????? 0?????????? 0
Doc-U-Mat: Quality Laundry and Books???? 85????????? 0?????????? 85????????? 0?????????? 0
Fricative Bookshop?????????????????????? 60????????? 35????????? 0?????????? 0?????????? 25
?
Answer 4:用动态SQL实现
Total??????????????????????????????????? 250???????? 60????????? 165???????? 0?????????? 25
Question5: The Fastest Way to Recompile All Stored Procedures
I have a problem with a database running in SQL Server 6.5 (Service Pack 4). We moved the database (object transfer) from one machine to another last night, and an error (specific to a stored procedure) is cropping up. However, I can't tell which procedure is causing it. Permissions are granted in all of our stored procedures; is there a way from the isql utility to force all stored procedures to recompile?
Tips: sp_recompile can recomplie a store procedure each time
Answer 5:在执行存储过程时,使用 with recompile 选项强制编译新的计划;使用