Questions tagged [sql-server-2008]

Use this tag for questions specific to the 2008 version of Microsoft's SQL Server.

Extended support for SQL Server 2008 and 2008 R2 have ended on July 9, 2019. That means the end of regular security updates. (source: SQL Server 2008 End of Support.)

If you're still using SQL Server 2008, you should seroiusly consider upgrading your SQL Server to a supported version.

SQL Server 2008 (codename Katmai, version number 10.00) was released on August 6 2008, and aims to make data management self-tuning, self organizing, and self-maintaining with the development of SQL Server Always On technologies, to provide near-zero downtime. SQL Server 2008 also includes support for structured and semi-structured data, including digital media formats for pictures, audio, video, and other multimedia data. In current versions, such multimedia data can be stored as BLOBs (binary large objects), but they are generic bitstreams. Intrinsic awareness of multimedia data will allow specialized functions to be performed on them. According to Paul Flessner, Senior Vice President, Server Applications, Microsoft Corp., SQL Server 2008 can be a data storage backend for different varieties of data: XML, email, time/calendar, file, document, spatial, etc as well as perform search, query, analysis, sharing, and synchronization across all data types.

Other new data types include specialized date and time types and a Spatial data type for location-dependent data. Better support for unstructured and semi-structured data is provided using the new FILESTREAM data type, which can be used to reference any file stored on the file system. Structured data and metadata about the file is stored in the SQL Server database, whereas the unstructured component is stored in the file system. Such files can be accessed both via Win32 file handling APIs as well as via SQL Server using T-SQL; doing the latter accesses the file data as a BLOB. Backing up and restoring the database backs up or restores the referenced files as well. SQL Server 2008 also natively supports hierarchical data and includes T-SQL constructs to directly deal with them, without using recursive queries.

The Full-text search functionality has been integrated with the database engine. According to a Microsoft technical article, this simplifies management and improves performance. Spatial data will be stored in two types. A "Flat Earth" (GEOMETRY or planar) data type represents geospatial data which has been projected from its native, spherical, coordinate system into a plane. A "Round Earth" data type (GEOGRAPHY) uses an ellipsoidal model in which the Earth is defined as a single continuous entity which does not suffer from the singularities such as the international dateline, poles, or map projection zone "edges". Approximately 70 methods are available to represent spatial operations for the Open Geospatial Consortium Simple Features for SQL, Version 1.1.

SQL Server includes better compression features, which also helps in improving scalability. It enhanced the indexing algorithms and introduced the notion of filtered indexes. It also includes Resource Governor that allows reserving resources for certain users or workflows. It also includes capabilities for transparent encryption of data (TDE) as well as compression of backups. SQL Server 2008 supports the ADO.NET Entity Framework and the reporting tools, replication, and data definition will be built around the Entity Data Model. SQL Server Reporting Services will gain charting capabilities from the integration of the data visualization products from Dundas Data Visualization, Inc., which was acquired by Microsoft. On the management side, SQL Server 2008 includes the Declarative Management Framework which allows configuring policies and constraints, on the entire database or certain tables, declaratively. The version of SQL Server Management Studio included with SQL Server 2008 supports IntelliSense for SQL queries against a SQL Server 2008 Database Engine. SQL Server 2008 also makes the databases available via Windows PowerShell providers and management functionality available as Cmdlets, so that the server and all the running instances can be managed from Windows PowerShell.

Source

53837 questions
256
votes
4 answers

How to wait for 2 seconds?

How does one cause a delay in execution for a specified number of seconds? This doesn't do it: WAITFOR DELAY '00:02'; What is the correct format?
Chad
  • 23,658
  • 51
  • 191
  • 321
253
votes
11 answers

How do you view ALL text from an ntext or nvarchar(max) in SSMS?

How do you view ALL text from an NTEXT or NVARCHAR(max) in SQL Server Management Studio? By default, it only seems to return the first few hundred characters (255?) but sometimes I just want a quick way of viewing the whole field, without having to…
NickG
  • 9,315
  • 16
  • 75
  • 115
252
votes
10 answers

How to restore to a different database in SQL Server?

I have a backup of Database1 from a week ago. The backup is done weekly in the scheduler and I get a .bak file. Now I want to fiddle with some data so I need to restore it to a different database - Database2. I have seen this question: Restore SQL…
LocustHorde
  • 6,361
  • 16
  • 65
  • 94
252
votes
10 answers

How to get a float result by dividing two integer values using T-SQL?

Using T-SQL and Microsoft SQL Server I would like to specify the number of decimal digits when I do a division between 2 integer numbers like: select 1/3 That currently returns 0. I would like it to return 0,33. Something like: select round(1/3,…
UnDiUdin
  • 14,924
  • 39
  • 151
  • 249
246
votes
10 answers

Changing the maximum length of a varchar column?

I'm trying to update the length of a varchar column from 255 characters to 500 without losing the contents. I've dropped and re-created tables before but I've never been exposed to the alter statement which is what I believe I need to use to do…
Michael A
  • 9,480
  • 22
  • 70
  • 114
245
votes
16 answers

How to get cumulative sum

declare @t table ( id int, SomeNumt int ) insert into @t select 1,10 union select 2,12 union select 3,3 union select 4,15 union select 5,23 select * from @t the above select returns me the following. id SomeNumt 1 …
ps.
  • 4,230
  • 5
  • 31
  • 39
241
votes
11 answers

How do I do multiple CASE WHEN conditions using SQL Server 2008?

What I'm trying to do is use more than one CASE WHEN condition for the same column. Here is my code for the query: SELECT Url='', p.ArtNo, p.[Description], p.Specification, CASE WHEN…
Nils Anders
  • 4,212
  • 5
  • 25
  • 38
231
votes
18 answers

How can I group time by hour or by 10 minutes?

Like when I do SELECT [Date] FROM [FRIIB].[dbo].[ArchiveAnalog] GROUP BY [Date] How can I specify the group period? I'm using MS SQL 2008. I've tried this, both with % 10 and / 10. SELECT MIN([Date]) AS RecT, AVG(Value) FROM…
cnd
  • 32,616
  • 62
  • 183
  • 313
230
votes
11 answers

How to connect to local instance of SQL Server 2008 Express

I just installed SQL Server 2008 Express on my Vista SP1 machine. I previously had 2005 on here and used it just fine with the old SQL Server Management Studio Express. I was able to connect with no problems to my PC-NAME\SQLEXPRESS instance (no,…
Rob
  • 25,984
  • 32
  • 109
  • 155
229
votes
6 answers

OPTION (RECOMPILE) is Always Faster; Why?

I encountered an odd situation where appending OPTION (RECOMPILE) to my query causes it to run in half a second, while omitting it causes the query to take well over five minutes. This is the case when the query is executed from Query Analyzer or…
Chad Decker
  • 5,997
  • 8
  • 27
  • 31
223
votes
17 answers

How to select the last record of a table in SQL?

This is a sample code to select all records from a table. Can someone show me how to select the last record of that table? select * from table When I use: SELECT * FROM TABLE ORDER BY ID DESC LIMIT I get this error: Line 1: Incorrect syntax near…
Tassisto
  • 9,877
  • 28
  • 100
  • 157
223
votes
11 answers

How to change column datatype in SQL Server database without losing data?

I have SQL Server database and I just realized that I can change the type of one of the columns from int to bool. How can I do that without losing the data that is already entered into that table?
Ivan Stoyanov
  • 5,412
  • 12
  • 55
  • 71
223
votes
5 answers

is of a type that is invalid for use as a key column in an index

I have an error at Column 'key' in table 'misc_info' is of a type that is invalid for use as a key column in an index. where key is a nvarchar(max). A quick google search finds that the maximum length of an index is 450 chars. However, this doesn't…
user34537
222
votes
8 answers

Modify table: How to change 'Allow Nulls' attribute from not null to allow null

How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe?
CrazyMouse
  • 2,497
  • 3
  • 15
  • 7
221
votes
8 answers

How to alter SQL in "Edit Top 200 Rows" in SSMS 2008

In SQL Server 2008 Management Studio, when I right click on a database table and choose Select Top 100 Rows, I can then e.g. easily add a ORDER BY statement to the SQL. That works fine. But when I do choose Edit Top 200 Rows, I don't have the…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047