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

Select all columns from all tables in SQL Server 2008

How can I Select all columns from all tables from the DB, like: Select * From * in SQL Server 2008??? The table list it´s very very big, and have so many columns, is it possible to do it without writing the column names? Or maybe make a select…
user185953
15
votes
4 answers

SQL MERGE to remote (linked) server table

Is it possible to utilize the SQL MERGE function on a linked server's database table? The end goal is to synchronize the remote table with our local SQL server table. I’ve done some research online and couldn’t find any related information. If it is…
devHead
  • 794
  • 1
  • 15
  • 38
15
votes
6 answers

How to get running sum of a column in sql server

Hi I have a column with name Qty from table Bills i want a column that show the running sum of Qty column like this : Qty Run_Sum 1 1 2 3 3 6 4 10 5 15 Suggest me some appropriate method to make running some thankx
user1448783
  • 263
  • 3
  • 5
  • 9
15
votes
2 answers

Using CASE to Return a String If No Results From SELECT Statement

Is it possible to use CASE to return a certain string if there are no results from my SELECT statement? Example: DECLARE @accountnumber AS VARCHAR(10) SET @accountnumber = 'account number to search' SELECT CASE WHEN account IS NOT NULL …
Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248
15
votes
5 answers

SSMS Object Explorer - Select Top N Rows missing when connected to Azure DB

I just upgraded my SSMS to 2008 R2. I'm missing the option to select the top 1000 rows from a table, like this: Mine looks like this: I know how to change the number of rows that are displayed, but the options aren't there at all. I saw that…
Bob Horn
  • 33,387
  • 34
  • 113
  • 219
15
votes
6 answers

How can I execute a .sql from C#?

For some integration tests I want to connect to the database and run a .sql file that has the schema needed for the tests to actually run, including GO statements. How can I execute the .sql file? (or is this totally the wrong way to go?) I've found…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
15
votes
1 answer

2 errors: The multi-part identifier "inserted.name" could not be bound

I'm trying to create a trigger to update a contact's info in a repository when it's been changed. CREATE TRIGGER contacts_f_tr ON contacts_f AFTER UPDATE AS BEGIN --- ---Update repository data --- IF UPDATE (mail) BEGIN UPDATE…
Luis M. Condor
  • 155
  • 1
  • 1
  • 5
15
votes
4 answers

The database [dbName] is not accessible. (ObjectExplorer)

I have an issue in regards to using SQL Server 2008 R2. I recently had an issue with my computer and therefore I had to reboot windows and had to grant permission from one user to another user (using the security feature in the properties). When…
greg
  • 1,289
  • 2
  • 14
  • 33
15
votes
5 answers

Return rows between a specific range, with one select statement

I'm looking to some expresion like this (using SQL Server 2008) SELECT TOP 10 columName FROM tableName But instead of that I need the values between 10 and 20. And I wonder if there is a way of doing it using only one SELECT statement. For example…
user1823901
  • 151
  • 1
  • 1
  • 4
15
votes
4 answers

Insert manually into a table by SQL statement, but key is autoincremented

Let's say I have a table of users and the id column is the primary key and auto incremented. I want to just try and add user manually by this statement: INSERT INTO table_name (id, username, password) VALUES (?, Mike, Mike); but I don't want to…
Mike
  • 1,302
  • 6
  • 23
  • 43
15
votes
5 answers

how to know how many rows will be affected before running a query in microsoft sql server 2008

i've read a bit about ROWCOUNT but its not exactly what im looking for. from my understanding rowcount states the number of rows affected AFTER you run the query. what im looking for is knowing BEFORE you run the query. is this possible?
user571099
  • 1,491
  • 6
  • 24
  • 42
15
votes
6 answers

Query a SQL field for whether it contains any one of multiple values

I want to query the rows of SQL column for whether it contains any one of multiple values. For instance, return rows of a table where its column A contains any of the following words: ('cow','farmer','milk'). Easy enough when you know what the words…
Matt
  • 25,943
  • 66
  • 198
  • 303
15
votes
4 answers

SQL: how to get sunday of current week

I want to get the last day( Sunday) of current week given any timestamp. I tried following script, but it returns Saturday as the last day rather than Sunday as I expected. Select DATEADD(DAY , 7-DATEPART(WEEKDAY,GETDATE()),GETDATE()) AS 'Last Day…
Echo
  • 1,117
  • 4
  • 22
  • 43
15
votes
4 answers

Using CASE Statement inside IN Clause

Is is possible to use a CASE statement inside an IN clause? This is a simplified version of what I have been trying to get to compile correctly: SELECT * FROM MyTable WHERE StatusID IN ( CASE WHEN @StatusID = 99 THEN (5, 11, 13) ELSE (@StatusID)…
crjunk
  • 949
  • 4
  • 21
  • 40
15
votes
3 answers

How to rename database in multi-user mode

I am working on SQL SERVER 2008 & 2008 R2. How can I rename a database in multi-user mode? I am using sp_rename but it returns this error: Msg 15225, Level 11, State 1, Procedure sp_rename, Line 338
Vikrant More
  • 5,182
  • 23
  • 58
  • 90