sql-server-2005

Importing Excel into SQL2005, issue with currency symbols and text in a number field

I have a field in my Excel as follows €250 €240 Free .... In my SQL2005 Preview this looks as follows 250 240 (Blank) So it doesnt like Symbols and Text in this column altho it is going to a varchar column. Any Ideas ? ...

Strange issue in SQL Management Studio IDE with CR instead of CRLF

I've encountered a strange feature (that may be related to SQL Management Studio) with regard to the placement of return characters at the end of SQL Statements. Whilst the query runs just fine within the ID, the feature in question was breaking our deployment scripts. Essentially, for some reason, certain lines were being terminated by...

In SQL Server 2005, is it possible to set transaction isolation level on a per-user basis?

In SQL Server 2005, is it possible to automatically set transaction isolation level to, say, read uncommitted an a per-user basis? (So for instance, if I set such a login option for user Fred, Fred wouldn't have to remember sprinkle his select statements with NOLOCK hints or remember to add in a set transaction isolation level statement...

Is it possible to Union the result sets of two CTEs with identical structure

I want to union the results sets from the following CTEs so that I get 4 rows of data. Id Name ------------- 1 Test1 2 Test2 3 Test3 4 Test4 The Sql I want to use is as follows ;with CTE1 (Id,Name) as ( select 1 as Id, 'Test1' as Name union all select 2, 'Test2' ) select * from CTE1 union all ;with CT...

Sql server 2005 :How to Import objects of a schema to another

Hi all, I have created several objects (Tables,Stored Procs, functions etc.) under a new schema (x) Now I want to import them to DBO schema. How can I do that.. Thanks ...

LINQ to SQL vs. SQL Server Reporting Services, which one is good enough for the following?

Basic reporting on content usage including time spent viewing a media asset, progress and interactivity based on % complete or correct for up to tens of thousands of users. Basic table and text based reports. Everything is in a SQL Server 2005 database. To me I don't feel like I should have trouble optimizing the LINQ to SQL to be good e...

No rows in MSDB.dbo.sysmail_faileditems

Initially I was getting a "no SELECT privilege" error when attempting to query contents for a report I need to create. So we granted DatabaseMailUserRole in MSDB to my account - I see columns, but none of the data we know to exist. What am I missing that needs to be done for my account to see the data? ...

TSQL Understanding the execution of the Query

I have two tables Table Visitor ID Name CityName 1 Jon NY 1 Jon KY 2 Paul NY 1 paul TY Table City ID CityName 1 NY 2 KY 3 TY I have to list the visitor who has visited all cities in City Table. I took the query from web,but i do not the how it works internally. The query is select distin...

can connection string in SQL Server 2005 be taken from a file??

I have created a web enabled DB for a company as a part of my internship and it's up and ready. However the connection string of the server is already coded by me. But the IT guy said that he wanted me to read the connection string from a file containing various connection strings and choosing whichever it wanted to at that time. My que...

This SQL query is not working for me please help

I have a poorly normalized set of tables and am trying to correct this issue. The DB is MS SQL 2005. Table1 has an id field (record ID), a mainID field (person ID) and a sequence field (and int that determines the sort order) Table2 has its own id field and a copy of the id for the first record by a person (sequence = 1). I've added ...

How can I post updates (commits) in oracle db to SQL Server 2005

We have an application (BaaN) on Oracle Database. We also have an application that is on SQL Server 2005 which uses Oracle (BaaN) contents. Currently we cache all contents of the Oracle DB to SQL Server nightly through linked server from SQL Server to Oracle. Thought of using a trigger on Oracle db tables to write contents to Oracle t...

SQL Query to return child records relative to groupings

I am developing a system to process recurring billing for members. Items to be purchased can be grouped together for a special package rate, or purchased individually for a higher, stand-alone rate. The portion of my database schema that determines the amount to be paid for recurring items consists of the following 4 tables: MEMBER_RECU...

Create Sql server replication with some data transformation (during or at the end)

Hi, i'm running a sql server replication to sync a table to a separate (reporting) database. In the source database, all records have a DateTime value (not so unusual) but it isn't stored as a DateTime, but as a Guid... which points to a table which contains all timestamps (one for every minute). Now what i would like to do is during ...

Help to compare all permutations of several columns in one sql server query

Hi I have a db related to horse racing performance and want to compare a horse's record under a number of different situations. For example I would like to see how it performs in the class it is due to run in, the course it is due to run at, with the person who will be riding the horse and over the distance it will run at. If we take th...

sql query (potentially solvable with pivot / unpivot?)

Hi, I'm not sure how best to approach this - I think a pivot / unpivot should be used, but not sure how to make it work (as pivoting column is a non-numeric) I have the following table (based on a query I can't modify): CREATE TABLE #data (donor_id NVARCHAR(50) ,last_gift DATETIME ,[2005] NVARCHAR(50) ,numgifts05 INT ,value_05 MONEY ,...

In Sql server, when should you use GO and when should you use semi-colon ; ?

I've always been confused with when I should use the GO keyword after commands and whether a semi-colon is required at the end of commands. When I run the Generate-script in sql server management studio, it seems to use GO all over the place, but not the semi-colon. Please can someone explain to me the differences and why/when i should...

need help understanding UPDATE...FROM...

hello, please help me to understand how the T-SQL's UPDATE FROM query works. the sample query below results in value-inc, value-dec value-inc, value-dec value-inc, value-dec value-inc, value-dec value-inc, value-dec value-inc, value-dec i expected this: null, 'value-dec' null, 'value-dec' null, 'value-inc' nul...

Problem connectiong to a SQL Server 2008 named instance using Hibernate

Hi, I'm using Hibernate to connect to an SQL Server 2008 named instance. This works if I use the default instance name but not when using the "named" instance. config.setProperty("hibernate.connection.url","jdbc:sqlserver://127.0.0.1\INSTANCE_NAME:1433;databaseName=DB_NAME;autoReconnect=true"); Any ideas why this happens? Thanks i...

SQL if no rows are returned do this....

I have a select statement and I want to say if this select statement does not return any rows then put a '' in every cell. How do I do this? ...

data source name not found and no default driver specified. Microsoft OLE DB Provider for ODBC Drivers

Hello, i'm not a windows administrator, so I do not know what I'm doing wrong. I have this script to get vmware esxi3.5 reports, http://paste.ubuntu.com/493213/ I get this error: C:\Documents and Settings\admmarc\Desktop\test\vcreport. DB Provider for ODBC Drivers: [Microsoft][ODBC Driver not found and no default driver specified...