首页 技术 正文
技术 2022年11月17日
0 收藏 446 点赞 3,216 浏览 3715 个字

一、SQL Server

1. 在数据库中查看某个字段或某张表的信息,Segment_Name 和 Table_Name 可模糊和准确查询:

 select * from INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME like '%<Segment_Name>%' select * from INFORMATION_SCHEMA.TABLES
where TABLE_NAME like '%<Table_Name>%'

2. 使用命令查看某个Procedure或Function的具体内容,当然也可以视图查看:

sp_helptext <Pro_Name or Fun_Name>    (直接写Pro_Name or Fun_Name,不需要加引号)

sp_who2 (查看数据库中表的相关信息)

3. 5个最常用的系统存储过程

There are a number of documented and undocumented system stored procedures in MS SQL Server that are helpful for every web developer working with databases. From the developer’s perspective, here’s a list of 5 System stored procedures that are my favorite.1. sp_helpPurpose:
sp_help gives information about database objects. If you wanted to quickly know the structure of a table but are too lazy to look for the schema diagram or to dig for the table you are interested in within the Object explorer, sp_help is here to helpSyntax:
It can be used without parameters to get the information of objects in the database.
It can be used with a parameter to get the information of a particular object Examples:
On the Adventure Works database:
Executing sp_help would yield the following recordsetExecuting sp_help ‘Person.Address’ yields the following recordsetNote that it is not required to enclose the object name within single quotes unless the object name has a dot in it.sp_help '<Table_Name>'2. sp_helptextPurpose:
sp_help gives definition information of objects such as system stored procedures, user defined stored procedures, user defined functions, triggers etc.Syntax:
viewplaincopy to clipboardprint?
sp_helptext <Name of the object> Example:
On the Adventure Works database:
Executing a sp_helptext 'dbo.uspGetBillOfMaterials' yields the following definition of the user defined stored procedure 3. sp_MSforeachtablePurpose:
Caution – This is an undocument stored procedure and should not be relied on. It is not listed in SQL BOL and should be used at your own risk.
This is a very useful stored procedure for executing a command for ALL the tables in the database. Say you wanted to get the number of rows in all the tables in your database, you could write: Example:
viewplaincopy to clipboardprint?
EXEC sp_MSforeachtable 'SELECT ''?'', COUNT(*) FROM ?'
The literal ?is used as a token to replace the table name. The output for the Adventure Works database is shown below For each table in the database, it would list the table name and the number of rows in that table.
Want to find out how much space is used by each table in your database. Try this:
viewplaincopy to clipboardprint?
sp_MSforeachtable 'execute sp_spaceused @objname = ''?'' '
More information on sp_spaceused later in this article. 4. sp_dependsPurpose:
Ever wanted to make a change to a table but were not sure what other objects are dependent on this table? There could be views or stored procedures that could break due to this change. In situations like this, sp_depends come to the rescue.Syntax:
viewplaincopy to clipboardprint?
sp_depends <Name of the object> Example:
In the Adventure Works database, say I wanted to find out all the objects that are dependent on the Person.Address table.
By executing sp_depends 'Person.Address', the result set is as shown sp_depends '<Table_Name>'5. sp_spaceusedPurpose:
This is a simple stored procedure that gives information on the size of the database or the database objectsSyntax:
If it is used without parameters, it would return the database information
viewplaincopy to clipboardprint?
sp_spaceused
If it is used with a parameter, it would return the information on the object
viewplaincopy to clipboardprint?
sp_spaceused <Name of the object> Example:
In the Adventure Works database, executing the sp_spaceused without parameters gives the following resultExecuting the sp_spaceused ‘Person.Address’ (on a table object)sp_spaceused '<Table_Name>'Conclusion This article gives a brief description on 5 useful system stored procedures that developers can use on a daily basis. Happy coding!

4. Reset DB common When DB state Recovery State.

  ALTER DATABASE DBNAME SET OFFLINE WITH ROLLBACK IMMEDIATE
  ALTER DATABASE DBNAME SET ONLINE WITH ROLLBACK IMMEDIATE

二、 HTML + JavaScript + CSS

1. 在web开发经常会遇到如: &nbsp; 这样的字符。它其实是Html将一些特殊字符(Html语法字符)的一种表达方式。

下面列举几个常用字符:

&nbsp;  空格

&amp;   &

&lt;       <

&gt;      >

&quot;   “

&qpos;   ‘

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,086
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,561
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,410
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,183
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,820
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,903