Archive for the ‘SQL Server’ category

Define Field In Virtual Table Using SQL Server 2005

June 28th, 2009

We can define the field of Virtual table in SQL Server 2005. There are some requisite when define the field of the virtual table.And  this case include inserting the content of the real table to that virtual table, they are:

- The amount of the field in virtual table must same with the selected field on the real table

- The data type of each field in virtual table must same with the real table

This is the example:

Step 1:

Let us create table [Employees_TEST] , insert the content of that table from existing table. [Employees] table as the sample

create_table_employees_test

Step 2:

Create virtual table #Employees_Temp and Insert data to that table from table [Employees_TEST]

create_virtual_table

Use Virtual Table In SQL Server 2005

June 27th, 2009

This is the simple way to insert data from one table to another virtual table. Maybe this way will help you when makes query.

create

REPLACE STRING IN SQL SERVER 2005

May 12th, 2009

sql_server_logo

REPLACE

Replaces all occurrences of the second given string expression in the first string expression with a third expression.

Syntax

REPLACE ( 'string_expression1' , 'string_expression2' , 'string_expression3')

Examples

This example replaces the string in “Testing Replace String” with Testing Replace String


SELECT REPLACE('"Testing Replace String"','"','')
GO

Here is the result set:

----------------------------
Testing Replace String
(1 row(s) affected)
----------------------------
Another example is in the following code

sql-server1