Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mathiyazhagan.sekar@gmail
Starting Member
11 Posts |
Posted - 2008-05-15 : 07:27:32
|
Hi all, I am new to this forum.could any one help me when and how to use master..spt_values ?Thanks,Mathi |
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-05-15 : 07:39:46
|
quote: Originally posted by mathiyazhagan.sekar@gmail Hi all, I am new to this forum.could any one help me when and how to use master..spt_values ?Thanks,Mathi
It is a system table and it contains numbers from 1 to 2047. It is very useful.for example if you need to populate a table with 100 numbers from 1.You can use this likedeclare @t table( id int)insert into @tselect distinct number from master..spt_values where number between 1 and 100select * from @t |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-15 : 07:41:27
|
To use the index seek prerogative, useselect number from master..spt_values where type = 'p' and number between 1 and 100instead. E 12°55'05.25"N 56°04'39.16" |
|
|
mathiyazhagan.sekar@gmail
Starting Member
11 Posts |
Posted - 2008-05-15 : 08:07:17
|
Thank You guys for providing clear picture of spt_values.why we are two dots after system DB (for example,master.. and tempdb..).Is there any special purpose for this ?Thanks,Mathi |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-15 : 10:07:34
|
quote: Originally posted by mathiyazhagan.sekar@gmail Thank You guys for providing clear picture of spt_values.why we are two dots after system DB (for example,master.. and tempdb..).Is there any special purpose for this ?Thanks,Mathi
Yes. they denote fully qualified namesi.e Server.Database.Schema.objectso master..spt_values suggests database is master and object name is spt_values. |
|
|
|
|
|