Databases are definitely used in project development. C # is the most used SQL Server of Microsoft. It is undeniable that Microsoft's Visual Studio development platform is easy to use, and smart prompts are an intuitive embodiment. After several characters are typed, the related information is listed, which is very convenient. If you use NotePad to write a paragraphCodeNo one is willing, because everyone is used to smart prompts. However, Microsoft did not do well in the database ide. It was not until sql2008 was added with a rather powerful smart tip. Currently, sql2005 is widely used. When writing code, fields can only be typed one by one. This is not a good taste. Even if you want to be lazy, you can only copy fields from the previous code. Fortunately, there is a better way to be lazy, that is, to install SQL prompt. A lot of nonsense. Next we will introduce this little stuff to ensure that you will love it if you are typing fields.
Installation Process
1. Exit the IDE of Vs and SQL.
2. Open the compressed package, run SQL prompt 3.msi, and follow the prompts to complete the installation.
3.ProgramAfter the installation is complete, the system runs automatically. To complete the cracking, you need to find the icon in the system tray, right-click it, and choose exit.
4. Run patch.exe In the compressed package and wait for 10 seconds until the following button changes to "OK ". You do not need to select the installation path of the program for the cracking package. Tip: many anti-virus software uses the cracking package as a Trojan. In this step, you must first disable anti-virus software.
5. In the Start Menu, choose red gate> SQL prompt 3> SQL prompt query analyzer integration and click Run.
After the plug-in is installed, an "SQL prompt" menu item will be added to the main menu of Vs and SQL ide To control and configure the plug-in.
The following describes how to use this plug-in.
1. Refresh Cache
When SQL 2005 is enabled, the plug-in runs automatically. The principle of this plug-in is to cache the tables, views, and stored procedures in the database. Therefore, when you open the query analyzer for the first time, the plug-in will have a cache loading process. In addition, it should be noted that this plug-in will not actively update the cache. If the objects in the Database Change, You need to manually refresh the cache, you can press Ctrl + Shift + D, you can also find SQL prompt-> refresh cache in the main menu.
2. Smart notification
When you write code in the query analyzer, this plug-in is similar to Vs and will be intelligently prompted. Not only lists the names of related objects, but also lists the object creation code. For example.
After the input is complete, move the mouse over the name of the database object, and the plug-in will also prompt ,.
Click the prompt tab to open the definition code of the database object.
A prompt is displayed when you move the cursor over fields and parameters, not just tables, views, and stored procedures.
3. Automatic insert
Of course, these functions are not very powerful if you simply list candidate items or give definitions and types of objects. Automatic Insertion will save a lot of time for coding.
For example, after "select * from table name" is input, press the tab key to automatically add "as alias ". After you move the cursor to "*", the message "press tab to expand wildcard" appears ".
What does this sentence mean? Press the "tab" key to view the effect:
Fields in this table are automatically listed. When there are many fields in the table, it will be a great help. How can this problem be solved.
Next, enter "insert into table name" and press the tab key to automatically implement the insert statement. The effect is as follows:
When multiple tables are joined, a prompt is displayed, which matches the field name or type (configurable ).
4. Code segment
If you are a lazy person, you must know that vs has a code segment. For example, if you enter for and press the tab key, the following code will appear:
Of course, SQL prompt won't miss such powerful functions. After it is installed, there are already many built-in code segments. For example, if you enter SSF, the plug-in will prompt the following:
Press the tab key to replace "SSF" with "select * from ". Other commonly used tables are as follows:
Abbreviations |
Code segment |
Be |
Begin... End |
BT |
Begin transaction |
DF |
Delete from |
FJ |
Full join |
II |
Insert |
IJ |
Inner join |
LJ |
Left join |
RJ |
Right join |
SCF |
Select count (*) from |
SSF |
Select * from |
St100 |
Select Top 100 * from |
Some common code segments are listed here, and many of them need to be viewed by yourself. "Can SQL prompt customize code segments ?", If you can immediately think of this problem, it means you are very lazy. Because vs can customize code segments, here you will certainly not meet these defined code segments. Obviously, SQL prompt is not so rigid, and custom code segments are required.
In the SQL ide Main Menu, find SQL prompt-> options and click the menu to bring up the configuration form. Switch to the snippets page and you will see the following interface.
Click "new" to add a custom code segment. For example, I define the data type as a code segment, for example:
In this way, when you need to enter the data type, input "dec" and press tab to convert it to "decimal" (), and input "NVC" to "nvarchar (50 ). It's much more convenient, so you don't have to worry about coding too many times. Especially for large segments of fixed format code, such as transactions, cursors, etc., greatly improve the input efficiency.
Here is a special symbol $ cursor $, which is used to specify the position where the cursor stays after the abbreviation is converted to a code segment. A similar symbol exists in the vs code segment. The cursor stops at the end of the multi-line code segment if it is not specified.
5. Configuration
After installing a software, many people will configure it according to their preferences. SQL prompt has many configuration items, such as case, shortcut keys, whether to automatically add aliases, and prompt display time. I will not introduce it in detail here. You can configure it according to your habits.
Finally, if you have any useful software or a good way to work, you can share it with us!