sql-server-2005

ms access adp calls a stored proc (SQL Server ) but just hangs in 2005 but ok in 2000

Hi This never happened before, the apd doesnt return any error messsages, just calls the stored proc (delete statement) but doesn't complete, no error message. This only happens when calling the sp on SQL Server 2005, it's fine with the same query in SQL Server 2000. It doesnt make any sense! Please Help!! I've run out of ideas, I wi...

Is it possible to get the SQL single column result as a comma separated string?

Possible Duplicate: How do I Create a Comma-Separated List using a SQL Query? I am working on a web application. I need the SQL query of single column selection like select recordid from device where accountid in (1,2)) I need this result to be formatted comma separated string from SQL. ...

In MS-SQL Server, How to change a db User from WithoutLogin to be associated with a login

I have an existing database. It has 1 non-default user (that is Without Login), and that user is the dbo. How do I associate this user with a login? ...

Invalid authorisation linked server

Want to copy data from 1 table to other and they are in different servers. I have set 2 servers as linked servers. In SQL Server Management Studio, Server Objects --> Right-click Linked Servers, and then New linked server. I gave the connecting server as my servername SERVER2 and type as SQLSERVER. Now i executed the query, Insert Into...

Title: CTE error

I am getting these errors while executing the following SQL please help me ;WITH myCTE AS (Select mcisi.* from coke_packaged_item AS spi JOIN coke_item AS si ON si.coke_id = spi.coke_id AND si.coke_item_id = spi.coke_item_id AND si.shipper_flag = 'n' JOIN merch_cat_import_coke_item AS mcisi ON mcisi.coke_id = si.coke_id AND m...

simple & fast sql server database backup and restore

Hi, I'm looking for a simple (simplest if possible) way of backing up and restoring a database. I want to do a backup in one state and then after doing some operations get back to the backed up state. Tried Database->Tasks->Back Up... and then Database->Tasks->Restore but I always get an error with: Restore failed for...DBName The t...

SQL Server 2005 and SQL Server 2008 how to make it compatible?

I have in production SQL Server 2005 and in Development SQL Server 2008 Database. I would like to detach database from production create tables, insert data etc. and then attach it back. How make it compatible after I make some changes in SQL server 2008? What is the right way to do it? ...

union versus or

let's say I've got two queries: select top 20 idField, field1, field2 from table1 where idField in ( select idField from table1 where field3 like '...' union select idField from table2 where field4 like '...' ) order by sortfield1 select top 20 idField, field1, field2 from table1 where field3 like '...' or idfield ...

Join Unlike Tables

I have 2 unlike tables and a large set of subqueries that have a key for each of those two tables. I need to join the two tables to each subquery. Table 1 Table1ID Table 2 Table2ID Subqueries Table1ID Table2ID Is there any way to join everything together? I have tried something similar to SELECT Table1.Table1ID, Table2.Table2ID...

How do I pass a column as a parameter in Stored Procedure?

How do I pass and use the column name to retrieve a bigint variable in the actual column? DECLARE @personID BIGINT, DECLARE @queryString varchar(500) Set @queryString = 'Select @personID = ' + @PersonColumnID + ' from dbo.Loss_Witness where WitnessID = @witnessID' exec(@queryString) Error message states "Must declare variable '@perso...

negative selection SQL Query

I have been tasked with returning a negative selection from our sql database. I'll define the criteria as best i can. Thus far I haven't crafted a query that has worked. Business Table [Bus Name] [Bus ID] Activity Table [Activity ID] [Bus ID] Activity Extension Table [Ext ID] [Activity ID] [Bus ID] I need the Business names for a...

How to call sp_help [table] for SQL Server when using Oracle SQL Developer as my client

I am using Oracle SQL Developer in a linux environment to connect to an SQL Server 2005. I don't seem to be able to make a sp_help [table_name] call. Previously, I found it quite useful when I was on a Windows environment using SQL Server management, and could make that call. Is there any way to do this? [edit] error message returned ...

Query to collect data from previous rows

I have a table with records as, in example data below a CO.Nr are TH-123,Th-456 and so on... I need to collect the data.. Nr. CO.Nr Employee Resp Description Date 1 TH-123 ABC NULL HELLO 10.05.2010 2 TH-123 NULL S14 ...

Can I add custom word breaking characters in SQL 2005 FTS?

How words break in the full text indexing process depends on what language you use, right? Now let's say I want to add a breaking character that usually is not, in any language. Example: I want words to break at the letter a how do I accomplish that? And let's also say I have a word that I want to act as a wordbreaker, for example th...

Can anyone help me find a helpful SQL centric manuals please

I am planning of implementing SQL centric in my work place to manage all our database systems. can anyone help me to find proper manuals for it? ...

Is it possible for 2 sql server 2005 databases to share a read only secondary data file (.ndf file)?

We have a large read only secondary database file. We have several different copies of the database for development purposes, each of which can have slight differences. Is it possible that all copies share the same .ndf file? The .ndf file is identical for each copy of the database. ...

SQL QUERY showing Between Dates as specific dates + Data belonging to each date!

This is how a table is presented SELECT RequestsID, Country, Activity, [People needed (each day)], [Start date], [End date] FROM dbo.Requests There will be a lot of requests, and I would like to sum up the "People needed" per day (!), not as Between Start- and End date. Also I would like to group by country, and have the possibility ...

name of tables & views in stored procedure in sql server 2005

Hi All, I have a stored procedure, I want to know the name of the tables and views use in that stored procedure, can any one suggest how can I do so. Thanks in advance. ...

SQL Server Stored Procedure with CHAR parm

This one DOES NOT work fine: ALTER PROCEDURE rconte.spPesquisaPesIdDadoCodigo24 ( @pPesCodigo24 char ) AS SELECT pesId FROM tblPesquisas where pesIdentificadorRandomico24ParaEmail = @pPesCodigo24 RETURN This one WORKS FINE: ALTER PROCEDURE rconte.spPesquisaPesIdDadoCodigo24 ( @pPesCodigo24 char(24) ...

Nhibernate : is it possible to make HQL generate SQL query with JOIN

Hello everybody This is my problem. I have a many-to-one relationship from a accountlist to a client When i want to list accounts with client name, my HQL query ("From accountlist") generates thousands SQL queries, one for the accountlist and one for each client. Is it possible, with HQL to force to make juste one sql request with a j...