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
178
votes
6 answers

SQL Server equivalent to MySQL enum data type?

Does SQL Server 2008 have a a data-type like MySQL's enum?
Patrick
  • 5,442
  • 9
  • 53
  • 104
177
votes
9 answers

SQL query to insert datetime in SQL Server

I want to insert a datetime value into a table (SQL Server) using the SQL query below insert into table1(approvaldate)values(18-06-12 10:34:09 AM); But I get this Error msg: Incorrect syntax near '10'. I tried it with the quotes insert into…
Shee
  • 1,875
  • 2
  • 14
  • 16
176
votes
15 answers

Remove Trailing Spaces and Update in Columns in SQL Server

I have trailing spaces in a column in a SQL Server table called Company Name. All data in this column has trailing spaces. I want to remove all those, and I want to have the data without any trailing spaces. The company name is like "Amit Tech Corp …
AGM Raja
  • 1,835
  • 2
  • 12
  • 11
175
votes
6 answers

Compare DATETIME and DATE ignoring time portion

I have two tables where column [date] is type of DATETIME2(0). I have to compare two records only by theirs Date parts (day+month+year), discarding Time parts (hours+minutes+seconds). How can I do that?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
174
votes
12 answers

Which are more performant, CTE or temporary tables?

Which are more performant, CTE or Temporary Tables?
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
174
votes
15 answers

Export query result to .csv file in SQL Server 2008

How can I export a query result to a .csv file in SQL Server 2008?
Gold
  • 60,526
  • 100
  • 215
  • 315
167
votes
14 answers

How to delete large data of table in SQL without log?

I have a large data table. There are 10 million records in this table. What is the best way for this query Delete LargeTable where readTime < dateadd(MONTH,-7,GETDATE())
user3107343
  • 2,159
  • 6
  • 26
  • 37
167
votes
8 answers

How to check SQL Server version

What are the possible ways to determine the deployed SQL Server version? I’ve tried to do it using the SQL Server software. I want to do it using a command line SQL statement.
Yameen Bashir
  • 1,687
  • 2
  • 11
  • 5
164
votes
9 answers

How to report an error from a SQL Server user-defined function

I'm writing a user-defined function in SQL Server 2008. I know that functions cannot raise errors in the usual way - if you try to include the RAISERROR statement SQL returns: Msg 443, Level 16, State 14, Procedure ..., Line ... Invalid use of a…
EMP
  • 59,148
  • 53
  • 164
  • 220
163
votes
9 answers

SQL SERVER: Get total days between two dates

I'm trying to get the total number of days between two days: 1/1/2011 3/1/2011 RETURN 62 Is it possible to do in SQL Server?
Pod Mays
  • 2,563
  • 7
  • 31
  • 44
162
votes
8 answers

SQL Server - Create a copy of a database table and place it in the same database?

I have a table ABC in a database DB. I want to create copies of ABC with names ABC_1, ABC_2, ABC_3 in the same DB. How can I do that using either Management Studio (preferably) or SQL queries ? This is for SQL Server 2008 R2.
sequel.learner
  • 3,421
  • 7
  • 22
  • 24
161
votes
3 answers

How do I declare and assign a variable on a single line in SQL

I want something like DECLARE myVariable nvarchar[MAX] = "hello world". Bonus points if you show me how to encode a quote in the string. E.g.: I want the string to read John said to Emily "Hey there Emily" my attempt would be DECLARE myVariable…
Justin
  • 10,667
  • 15
  • 58
  • 79
161
votes
7 answers

How do I create a SQL table under a different schema?

This is from SQL Server 2008, ssms When I create a table, it creates under dbo. I would like to create it under a different schema, but when I use the 'New Table' dialog, I can never find the field where to specify this.
Matt
  • 25,943
  • 66
  • 198
  • 303
159
votes
2 answers

SQL Server Management Studio SSMS tries to "save to file" instead of execute on F5

This happens intermittently and seems to be related to accidentally hitting a key. Any ideas what causes this?
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
158
votes
5 answers

How can I create a unique constraint on my column (SQL Server 2008 R2)?

I have SQL Server 2008 R2 and I want to set a unique column. There seems to be two ways to do this: "unique index" and "unique constraint". They are not much different from what I understand, although unique constraint is recommended by most,…
White Island
  • 2,571
  • 4
  • 17
  • 13