sql-server-2008

Building Query from Multi-Selection Criteria

Hi All, I am wondering how others would handle a scenario like such: Say I have multiple choices for a user to choose from. Like, Color, Size, Make, Model, etc. What is the best solution or practice for handling the build of your query for this scneario? so if they select 6 of the 8 possible colors, 4 of the possible 7 makes, and ...

Audit the target of a SQL Server login

I've recently inherited a SQL server (2008, not R2) where some users connect to the server using the computer name and some users connect using a DNS alias. There is only the default instance on this server. Is there any way I can log or audit the connection string or target of the connection to see whether a user is connecting using the...

Incorrect syntax error when accessing remote stored procedure

Hello again, StackOverflow - I'm still trying to deploy this site, but with every problem I solve, another arises. Anyways - I've set up the database at my hosting to allow remote connections, and it is running Sql Server 2005. On my development machine, I am working with Sql Server 2008. I've installed the asp.net schema on my hosted ...

SQL Server 2008 and the commandline tool bcp: are there different versions around?

I got the problem having written a little procedure to import some flatfiles in a table using openrowset...bcp... which didn't work at customers site. A short check with bcp /? shows a different behaviour e.g. the switch -T was not trusted connection but rather something with Images. Are there different versions of bcp delivered? ...

Text Qualifier in flat file connection

Hi All, I have business scenario as source files (text files) comes to load into SQL database so I used the flat file connection manager as normal process. My requirement as, we are getting source files with qualifier (") so we used the text qualifier property in the connection manager. For the same set of files we are getting withou...

What is the best solution to retrieve large recordsets - more than 3000 rows

I have a SQL Server table with 3000 rows in it. When I retrieve those rows it is taking time using a Select Statement. What is the best solution to retrieve them? ...

T-Sql - Order By on Alphanumeric

Hi folks, i have a list of alphanumeric tokens, say '1a', '1b', '02', '03', '10', '11', etc... Now, what's the best way to do an order by on this list of tokens? I am getting '1a', '1b', '10', '11', '02', '03', but i need it to be '1a', '1b', '02', '03', '10', '11' UPDATE ok, i am doing this after the suggestion but it's not w...

Incorrect syntax error when accessing remote stored procedure

Hello again, StackOverflow - I'm still trying to deploy this site, but with every problem I solve, another arises. Anyways - I've set up the database at my hosting to allow remote connections, and it is running Sql Server 2005. On my development machine, I am working with Sql Server 2008. I've installed the asp.net schema on my hosted ...

where can i learn to program the sqldatasource

i am using linked severs and synonym in sql server 08 in vs08 webpage when i connect the sqldatasource to the db it doesnot show the linked server or the synonyms!! (i dont know why it doesnot show the linked severs). so i write queries manualy for the sql datasource like select * from synonymname; i would like to use the facilities g...

SQL - Is it better to do a subquery here or an extended WHERE clause?

The CUST table below will be joined with ~10 tables. For this subquery in particular, am I better off simply joining up directly with the Customer table and moving the subquery's 4-part WHERE clause to the main query's WHERE clause? I'm primarily wondering if it is possible to cut down on the amount of processing that SQL Server has to...

syscolumns table?

Hello everyone, I am using SQL Server 2008 Enterprise on Windows Server 2008 Enterprise. When I open master database in SQL Server Management Studio. I can not find syscolumns table under Tables -> System Tables of master database. Where is syscolumns table? thanks in advance, George ...

sys.columns access issue

Hello everyone, I am using SQL Server 2008 Enterprise on Windows Server 2008 Enterprise. I am wondering for SQL Server authentication mode (not Windows authentication mode), how to grant non-sa user to be able to access this view? thanks in advance, George ...

insert identity table column value

i have table propertybag, it's have only one identity coloumn fo eg propertybagid identity(1,1) i want to insert this value to this column one by one by query how? plz reply soon ...

SQL Server 2008 Table Partitioning

I have a huge database that has several tables that hold several million records. It's holding engineering data for a client and continually grows. This is impacting performance, even with optimised indexing. So I've been looking at partitioning. However, I would be looking at partitioning on a version held in a table. In it's most sim...

syscolumns table permission issue

Hello everyone, I am using SQL Server 2008 Enterprise on Windows Server 2008 Enterprise. In SQL Server Management Studio, I can execute the statement "select * from syscolumns" successfully, but I can not find the syscolumns table from SQL Server Management Studio, any ideas what is wrong or how to find this table? (I mean syscolumns t...

Visual Studio 2010 Schema Compare - Update Script Generation

When comparing schemas from a SQL 2008 database to a Visual Studio 2010 database project, if the schema name has a space in it, the script generator generates the following: create view "Alphabetical list of products" AS... When the database project is built, it throws errors due to incorrect syntax (the double quotes). Is there an op...

SQL Server 2008 GEOGRAPHY STDistance() value

Hi, I am using geography.STDistance() to return the distance between two single point locations. I'm curious as to which measurement is used for the return value? Is it in KM's, miles or perhaps some other? I'm getting results back upwards of 250k but i've no idea if im doing something wrong with my TSQL as these are historical location...

sql server insert records from one table to another

how does one insert records from one table to another that has a unique index in the destination table without going through the insert and then removal of duplicates by deleting the index? INSERT INTO forms(url,feedUrl, dateadded) SELECT url, feedurl, dateadded FROM Book3 T2 where not exists(select * from forms T1 where T1.url = T2.url...

Sql Server 2008 Select From table with AND style conditions in related tables

Given a model like this ProductFacets contains the following data: ProductId, FacetTypeId 1, 1 1, 2 2, 1 2, 3 3, 4 3, 5 4, 1 4, 2 I'd like to be able to select all Products which have a FacetTypeId of 1 AND 2. The result set should contain ProductIds 1 and 4 ...

Copy from SQL Server 2005 to SQL Server 2008 causes x2 data space #SQLHelp

A colleague of mine is copying data from SQL Server 2005 to SQL Server 2008. The destination database lives on a SQL Server 2008 instance but is set to Compatibility Level 90. The source database lives on a SQL Server 2005 instance and is set to Compatility Level 90. He is using SQL Server Integration Services 2008 to perform the co...