sql-server-2008

incorrect syntax near ':' in SQL

I am using SQL Server Management Studio to run a script on SQL Server 2008. Following simple statement throws error "Incorrect syntax near ':'". :setvar DatabaseName "USHR1.2" Curious, what's going on here. Appreciate your help! ...

Visual Studio DB GDR2 - Can I deploy to a File without SysAdmin Privleges?

I have a Data Solution that has a Database Project and a Server Project. I want to deploy to an SQL Script. I don't want to have to have SysAdmin privileges on the SQL Server (SQL 2008). Is there a way to do this? I really don't want to set any settings or upload any server level stuff. I only have the server project because my DB p...

SQL Sub-query -- Select JobID with a maximum JobValue

This seems like an easy thing, but I'm drawing a blank. Select * from .... inner join ( select JobsID, Value from Jobs where Value **is the highest** ) as MaxJob on MaxJob.CustID = A.CustID inner join ( select other information based upon MaxJob.JobID ) as OtherStuff Is there a nice way to have that first subquery gi...

What is the url for the Cumulative update package 3 for 64bit SQL Server 2008 SP1

Hi, Is Cumulative update package 3 for SQL Server 2008 SP1 available for 64 bit SQL server? I couldnt find the link. Please advice. Thanks- Manjot ...

UTC time in SQL tables

Columns such as CreatedDate and ModifiedDate are commonly used in the SQL tables. I think, storing the UTC value of the time would help remove dependency on the location of the server hosting the app. With the cloud computing gaining familiarity(even excluding it), the applications could be hosted in any timezone and in any part of the w...

SQL Server 2005 Syntax Help - "Select Info based upon Max Value of Sub Query"

The objective is below the list of tables. Tables: Table: Job JobID CustomerID Value Year Table: Customer CustomerID CustName Table: Invoice SaleAmount CustomerID The Objective Part 1: (easy) I need to select all invoice records and sort by Customer (To place nice w/ Crystal Reports) Select * from Invoice as A inner join...

String compare with 'strange chars' in SqlServer

I have some content in our database with (for our language) 'strange' characters. For example: Å When using the like statement in Sql Server with the letter A, this does not return a result because the Å is not an A. Is there a way in SqlServer to treat the Å as an E (and the é as an 'e' etc)? ...

SQL 2008 filestream

Hello. Is there a way to retrieve the filename for filegroup filestream? I try to create a new database in tsql, i need to create the filestream path for the database. but i dont know the path of the folder to put the filestream in. So i try to get the filename path of another database on the same server to configure the new database....

connect to analysis services from excel 2007 on windows 7

Is it possible to connect to an Analysis Services Database (2008) from Excel 2007 on Windows 7? I have installed the "Microsoft SQL Server 2008 Analysis Services 10.0 OLE DB Provider" but it's not possible to create a connection. It works on windows XP and on Windows Vista so I guess the problem is Windows 7? ...

SQL Query to search schema of all tables.

I am working on a SQL Server 2008 Db that has many tables in it (around 200). Many of these tables contain a field by the name "CreatedDate". I am trying to identify all the table schema with this particular field. Is there a SQL query to do this? Appreciate your response! ...

Sql Server 2008 MERGE - best way to get counts

I'm wondering what y'alls would recommend as the best way to go about getting the action counts from a MERGE statement in Sql Server. So, i.e. I run a MERGE which does some inserts, some updates and some deletes, ... I would like to be able to find out HOW MANY inserts, HOW MANY updates and How Many deletes. What'd be the best way to...

Visio data model diagram to db.

I have created my db data model diagram using Visio. Is there a way to generate the DB schema from the Visio? Appreciate your response! ...

Create a folder in SQL Server 2008 like 'system databases'

In SQL Server 2008 Management Studio, how do I create a folder in my 'databases' folder similiar to 'system databases'. It would be a great way to group like db's. ...

Finding K-mean Centroid in SQL Server 2008 clustering algorithm

How do you find centroid values for each cluster using the excel data mining plug-in (or SQL Server 2008)? In particular, how can the centroids be measured accurately when their vectors include nominal and boolean values? I've read the online books and I only got as far as node_distribution. I'm looking for centroid values or an algori...

SQL Server Column Display Order

When you create a table via scripts it appears to just list the columns in order of creation. It's a minor annoyance, but I like a certain method to the madness. When I later add a column with ALTER TABLE, how do I make it show up in a specific place when viewing the table in interactive tools such as enterprise manager? ex: Table Fo...

Common Table Expressions Versus Temp Table

I'm new to SQL 2008. As I look at the Common Table Expressions (WITH keyword), how is the performance compared to using a temp table. Besides syntax / readability, are there any other benefits to using CTEs? ...

Advanced SQL SERVER 2008 videos

Hello, Where do I find advanced SQL SERVER 2008 videos? Thanks ...

Is the Sql2008 MERGE syntax what I should be doing, here?

Hi folks, I've got a classic case of UPDATE or INSERTing some data into a table. I'm not sure if I should just do an UPDATE and if i get zero ROWCOUNT, then do an INSERT. Alternatively, I've heard rumours that the MERGE statement now replaces this, but I'm not sure how and if it's appropriate, in this situation. Here's some sample sql ...

Is there an easy way to verify replication articles are correct?

On a Publication (secondarily, a Subscription), is there a script or command I can run that verifies that the articles currently in place match what is expected and/or correct? If changes were manually made to a replication database (i.e. a table's "MSMerge_ins_..." trigger is modified or deleted, causing replication of that table to fu...

How can I extract string ‘abc.com’ from a string http://[email protected] using sql?

How can I extract string ‘abc.com’ from a string http://[email protected] using sql? ...