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
158
votes
15 answers

How to convert float to varchar in SQL Server

I have a float column with numbers of different length and I'm trying to convert them to varchar. Some values exceed bigint max size, so I can't do something like this cast(cast(float_field as bigint) as varchar(100)) I've tried using decimal, but…
hgulyan
  • 8,099
  • 8
  • 50
  • 75
157
votes
4 answers

Real life example, when to use OUTER / CROSS APPLY in SQL

I have been looking at CROSS / OUTER APPLY with a colleague and we're struggling to find real life examples of where to use them. I've spent quite a lot of time looking at When should I use CROSS APPLY over INNER JOIN? and googling but the main…
Lee Tickett
  • 5,847
  • 8
  • 31
  • 55
156
votes
11 answers

INSERT INTO vs SELECT INTO

What is the difference between using SELECT ... INTO MyTable FROM... and INSERT INTO MyTable (...) SELECT ... FROM .... ? From BOL [ INSERT, SELECT...INTO ], I know that using SELECT...INTO will create the insertion table on the default file group…
jowenece
  • 1,860
  • 2
  • 13
  • 13
156
votes
18 answers

Converting Select results into Insert script - SQL Server

I have SQL Server 2008, SQL Server Management Studio. I need to select data from a table in one database and insert into another table in another database. How can I convert the returned results from my select into INSERT INTO ...? Clarification…
Captain Comic
  • 15,744
  • 43
  • 110
  • 148
151
votes
3 answers

Lock Escalation - What's happening here?

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I noticed that the change script it generated drops the column, says "go" and then runs an additional ALTER TABLE statement that appears…
James Alexander
  • 6,132
  • 10
  • 42
  • 56
150
votes
10 answers

Delete all the records

How to delete all the records in SQL Server 2008?
kaveh
  • 1,509
  • 2
  • 9
  • 3
149
votes
6 answers

How can I schedule a job to run a SQL query daily?

I need to know how to make a SQL query run daily using a SQL Server Agent job, with minimum required configuration settings.
Bobj-C
  • 5,276
  • 9
  • 47
  • 83
148
votes
3 answers

Unpivot with column name

I have a table StudentMarks with columns Name, Maths, Science, English. Data is like Name, Maths, Science, English Tilak, 90, 40, 60 Raj, 30, 20, 10 I want to get it arranged like the following: Name, Subject, …
Tilak
  • 30,108
  • 19
  • 83
  • 131
147
votes
8 answers

SQL Joins Vs SQL Subqueries (Performance)?

I wish to know if I have a join query something like this - Select E.Id,E.Name from Employee E join Dept D on E.DeptId=D.Id and a subquery something like this - Select E.Id,E.Name from Employee Where DeptId in (Select Id from Dept) When I…
Vishal
  • 12,133
  • 17
  • 82
  • 128
145
votes
9 answers

Is there a way to access the "previous row" value in a SELECT statement?

I need to calculate the difference of a column between two lines of a table. Is there any way I can do this directly in SQL? I'm using Microsoft SQL Server 2008. I'm looking for something like this: SELECT value - (previous.value) FROM…
Edwin Jarvis
  • 5,980
  • 6
  • 36
  • 41
143
votes
18 answers

How to print VARCHAR(MAX) using Print Statement?

I have a code which is: DECLARE @Script VARCHAR(MAX) SELECT @Script = definition FROM manged.sys.all_sql_modules sq where sq.object_id = (SELECT object_id from managed.sys.objects Where type = 'P' and Name = 'usp_gen_data') Declare @Pos…
peter
  • 2,396
  • 6
  • 24
  • 29
142
votes
5 answers

How to take last four characters from a varchar?

I'm trying to take the last four characters only from a varchar field. All the rows are different lengths. What function should I be using to accomplish this?
Michael A
  • 9,480
  • 22
  • 70
  • 114
141
votes
9 answers

Unable to login to SQL Server + SQL Server Authentication + Error: 18456

I have created login account on my localhost\sql2008 Server (Eg. User123) Mapped to Database (default) Authentication Mode on SQL Server is set to both (Windows and SQL) But login to SQL Server fails with following message (for User123) Note: Have…
Sreedhar
  • 29,307
  • 34
  • 118
  • 188
139
votes
16 answers

Split function equivalent in T-SQL?

I’m looking to split '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15...' (comma delimited) into a table or table variable. Does anyone have a function that returns each one in a row?
jinsungy
  • 10,717
  • 24
  • 71
  • 79
138
votes
10 answers

How do I find duplicates across multiple columns?

So I want to do something like this sql code below: select s.id, s.name,s.city from stuff s group by s.name having count(where city and name are identical) > 1 To produce the following, (but ignore where only name or only city match, it has to be…
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311