|
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
You can use one of the following to know the structure of a table
Generate SQL Script option from Enterprise Manager/Management Studio
select * from information_schema.columns where table_name='table_name'
EXEC sp_help 'table_name'
EXEC sp...
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
This is just for Fun. The following code is unformatted, unclear and may be confusing. But curious to know the result? Set the result mode of the query window to Text . While you are in Query Window press CONTROL+T and run the following code and see wha...
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
In the Query Analyser, set the Result mode to Text (Press CTRL+T) and run the following code
set nocount on
select
space(17-len(replicate(char(94),no)))+ replicate(char(94),no*2-1)
from
(
select top 10 row_num...
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
Square braces in SQL Server play a major role in T-SQL programming. When an object name contains a space, special character, etc, the only way to express them is to put them aroud squre braces. Consider that you want to create a table user master (with ...
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
Have you ever tried creating objects and giving them strange names? I made some experiment at one of lab servers, main focus was space (you know, the long key at the bottom of the keyboard :D). So, without further ado - the first object to be tested is ...
|
-
Adam Tokarski Liked 1 Years ago through Blogs | 1 Point
If a non clustered index is created on expected WHERE clause and JOIN columns of a query but still to satisfy the query and to get values for column which are not included in non-clustered index, optimizer refers to data pages. This trip to data pages t...
|
-
Adam Tokarski Commented 1 Years ago through Blogs | 1 Point
Sankar,do you mean its better - in this case - to write:
CREATE NONCLUSTERED INDEX [IX_StandardCost]
ON [Production].[Product] ([ProductID] [StandardCost] ASC ) INCLUDE ( Name, ProductNumber )
and write column [ProductID] explicity?...
|
-
Adam Tokarski Commented 1 Years ago through Blogs | 1 Point
Sankar,do you mean its better - in this case - to write:
CREATE NONCLUSTERED INDEX [IX_StandardCost]
ON [Production].[Product] ([ProductID] [StandardCost] ASC ) INCLUDE ( Name, ProductNumber )
and write column [ProductID] explicity?...
|
-
Adam Tokarski Liked 2 Years ago through Blogs | 1 Point
Today, we will talk about a slightly different, yet very common subject. We will talk about what are the different ways to measure the number of rows in a table. I found a couple of posts over the Internet, and I will reference them as and when I demon...
|
-
Adam Tokarski Liked 2 Years ago through Blogs | 1 Point
Suppose you have string in csv format and want to split into seperate columns. You can use parsename function as long as you have maximum four values. The following would work for any number of values
declare @s varchar(2000),@data varchar(2000)
...
|