sql-server

Getting age in years in a SQL query

Hello I've been tasked with doing a few queries on a large SQL Server 2000 database. The query I'm having trouble with is "find the number of people between ages 20 and 40" How would I do this? My previous query to get a count of everyone looks like this: select count(rid) from people where ... (with the ... being irrelevant cond...

DBA's say no to SQL Server DTC?

I am trying to get our DBA's to enable DTC on a cluster of SQL Server 2005. Unfortunately they keep refusing. Their argument that they would need to set up a dedicated host for DTC (Could take months!!) as it is not a matter of ticking a few boxes. Is this true? How intrusive is DTC on a shared environment such as a SQL farm. Do I have a...

Migrating Data to SQL Server 2008

I am trying to migrate data from an Informix database to SQL Server 2008. I've got quite a lot of data to move. I've been try multiple methods to get the data over, and so far SQLBulkCopy in multiple chunks seems to be the fastest that I can find. Does anyone know of a faster means of getting the data over? I'm trying to cut down on the...

SQL multiple primary keys - localization

I am trying to implement some localization in my database. It looks something like this (prefixes only for clarification) tbl-Categories ID Language Name tbl-Articles ID CategoryID Now, in my tbl-Categories, I want to have primary keys spanning ID and language, so that every combination of ID and language is unique. In tbl-Articles...

NHibernate, the Parallel Framework, and SQL Server

hey guys, we have a loop that: 1.Loops over several thousand xml files. Altogether we're parsing millions of "user" nodes. 2.In each iteration we parse a "user" xml, do custom deserialization 3.finally, in each iteration, we send our object to nhibernate for saving. We use: .SaveOrUpdateAndFlush(user); This is a lengthy process, an...

Rails - MS-SQL Server problems (unixODBC, FreeTDS) on Mac 10.6

Followed the instructions on the Rails wiki and have had success connecting to SQL Server 2000 with TSQL -- both with DSN-less and DNS connections. I'm running Mac OS X 10.6.3. Wiki instructions here. Installed ruby-odbc, dbi (0.4.0), dbd-odbc (2.4.5), activerecord-sqlserver-adapter (2.3.5). In my database.yml (Rails 2.3.6): develop...

Calculating age based on date of birth in SQL and C#?

Possible Duplicates: How to calculate age (in years) based on Date of Birth and getDate() How do I calculate someones age in C#? How to calculate the customer age automatically by using their Date of Birth using c# and SQL Server 2005 ...

How to remove identity column from table

I have created a table with employee id as identity column. Now, I want to remove identity and replace datatype as bigint. I am using Sql Compact edition. How to achieve this? ...

Which file types are worth compressing (zipping) for remote storage? For which of them the compressed size/original size ratio is << 1?

I am storing documents in sql server in varbinary(max) fileds, I use filestream optionally when a user has: (DB_Size + Docs_Size) ~> 0.8 * ExpressEdition_Max_DB_Size I am currently zipping all the files, anyway this is done because the Document Read/Write work was developed 10 years ago where Storage was more expensive than now. Many...

Sql Query to list all views in an SQL Server 2005 database

I need an sql query to enumerate all views (I only need the view names) of a specific database in SQL Server 2005. Thanks in advance! ...

What is the quickest way to import 60m records into SQL

I have a 5-6 tables in my database that I need to populate with test data to test peroformance in my app. I can write a code and do a bulk insert my prediction is that it will take nearly 3 days to run so I assumed there must be a quicker way. Any ideas? ...

I cnn't use Database in SQL Azure!

Hi, I am trying to use a Database in SQL AZURE. I have installed SQL Server 2008. I can Login SQL Azure and can use master Database. But I can't use other Database and I can't see any things in my object explorer. Its Show Error: "USE statement is not supported to switch between databases. Use a new connection to connect to a different ...

Same query, different execution plans

Hi, I am trying to find a solution for a problem that is driving me mad... I have a query which runs very fast in a QA Server but it is very slow in production. I realized that they have different execution plans... so I have try recompiling, cleanning the cache for the execution plans, update statistics, check the type of collation......

OPENROWSET inserts null

Hi, I am using this: insert into bla select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;HDR=YES;Database=c:\bla.xls', 'select * from [Sheet1$]'); but for some reason some values contain null although the original data definately contains values (e.g. 'abc'). What could be the reason for this strange behaviour. Th...

How can I convert bigint (UNIX timestamp) to datetime in SQL Server?

How can I convert bigint (UNIX timestamp) to Datetime in SQL Server? ...

Two Instances of Sql Server (2005 and 2008)

Hi All, I installed Visual Studio 2008 Professional in my machine and It had installed SQL Server Express 2005 database in machine, and I use it very fine! I installed SQL Managment Studio and works great. So, in this week I Installed Visual Studio 2010 Pro in machine and the setup installed the SQL Server express 2008 and it overwrite...

Store in DB or not to store ?

There are few string lists in my web application that i don't know where to store in DB or just class. ie. I have 7 major browsers with which users enter the site. I want to save these stats thus i need to create browser column in UserLogin database. I don't want to waste space and resources so i can save full browser name in each login...

How to close and open access to SQL Server 2008 in Windows application?

Hi, I'm using SQL Server 2008 (without application server or anything). Numbers of users can be up to 1000. Windows Authentication is used. The question is: How to handle modes, so some users will be allowed to work in read-only mode some users won't have access to db for some time My versions: Using a table w...

TSQL - How to URL Encode

Hello Everyone, Looking for a bug free tested sql script that i could use in a UDF to encode a url through sql. Function would take in a URL and pass out a URL Encoded URL. I have seen a few, but all i have come across seem to have some flaws. Thanks in advance, Billy ...

Integrate Lucene or any other search product with SQL Server 2005

Hi, I need to use full text search with SQL Server 2005 and I have explored its inbuilt search approach (SQL Server full text indexing) but it seems less powerful. I have also looked features of Lucene. Now my questions: Is is possible to integrate Lucene and SQL server in anyway? Can my T-SQL queries use Lucene index for returning ...