sql-server

Setting query timeout on a stored procedure in SQL Server 2005

Does anyone know how to set the timeout on a stored procedure? Found some examples on the NET, e.g sp_configure 'remote Query Timeout', 5, but this did not work. Also found some commands "DBPROP_COMMANDTIMEOUT" and "DBPROP_GENERALTIMEOUT" but i don't know if they are the right ones to use and if they are, how to use them in my transact-S...

Looks simple, but I'm stumped!

This should be so simple, but I'm drawing a blank. I have two tables. Table:article_tag_pvt colum: article_id column: tag_id Table: tag column: tag_id column: name The article_tag_pvt table is a many-to-many pivot table. The problem is, I need a query which given a list of tag names, will retrieves article Ids which ONLY match tho...

Delphi: using BigInts from a database

I´m using Delphi 7 with devart dbExpress to connect to SQLServer. The problem is that when I add a bigInt field to a ClientQuery it comes as TFMTBCDField. And the TFMTBCDField don´t have a method to get the 64 bit value. I can use the Field.AsVariant or the StrToInt64(Field.AsString) to pick this 64 bits value. Is there a better way t...

SQL Server Express : Reporting Services.. limitations on charts?

Hi, If you look the edition comparison... http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx It says for Express Edition that this option is not enabled for SQL Server Express.. Enhanced Gauges and Charting Anyone know what the limitations are on this item? I can't seem to find any more information.. Many thanks, ...

insert into sql server table and get back primary key

i have a primary key set up to auto increment. i am doing multiple queries and i need to retrieve that primary key to use as a foreign key in another table (is identity = true) is there any elegant way to get back the primary key when i do an insert query. right now i am requerying and getting the highest value in that column which se...

what would be the primary key of the Table "Pictures" in this example

Table: PhotoAlbum Columns: AlbumID AlbumName AlbumDate AlbumDescription Table: Pictures Columns: PictureID AlbumID The issue is that i am using picture ID as a reference to a pic within an album so the data is duplicated for each album for that field. ...

How do you backup and restore a database as a copy on the same server?

I have a SQL2005 Express database that I would like to create a copy of on the same instance. How do you go about doing this with a script? I already have a script for generating the backup, but the restore is failing... THE ERROR: Msg 3234, Level 16, State 2, Line 2 Logical file 'MyDB_data' is not part of database 'MyDB_Test'...

How to write sql to set alter a column's default value in sql server 2005?

I have a table [Product] with a column [CreateTime] datetime null, and is has some data already. How can I set the column [CreateTime] 's default value to getdate(), and make the new added data to have a default value getdate() for column [CreateTime]. ...

upload data from ms access to sql server

i have already created a schema in sql server. is there any quick way to upload the data from table to table from msaccess to sql server. what if the col names have changed slightly? ...

How to store certain number of backups in backup file

I have everyday schedule to backup my database in sqlserver 2005. Now it's looks like this: BACKUP DATABASE [db1] TO DISK = N'D:\SqlServer\Backup\db1.bak' WITH NOINIT , NOUNLOAD , NAME = N'db1backup', NOSKIP , STATS = 10, NOFORMAT But in this case, it's will grow infinitely and I want to store only last 7 backups in file. How c...

SQL Server Reports Aggregate Functions

G'day, I'm a total n00b when it comes to SQL Server reports and my Vb.Net knowledge is ageing now. I have a detailed report of rows in a database, with one of the columns that is nullable. What I want to do is show a simple pie chart over the data in the result which shows how many rows have a value and how many do not. I can't work ...

Which is faster for SSIS, a View on a table or a Conditional Split?

I have an SSIS project where one of the steps involves populating a SQL Server table from an Oracle Table. The Oracle table has a column ssis_control_flag. I want to pull across all records that have this field set to 'T'. Now, I was wondering which would be the best way of doing this, and the two options as I have detailed in the qu...

How to give a user only select permission on a database

Hi , I want a to create a new user on a db with only the select permissions (read only access) how can i do this ? i'm working with sql 2008 ...

Why does fulltext search in SQL Server works better with an English index for non english content?

I have the following query SELECT ct.Id,rankdegree FROM (SELECT c.[KEY] as ID ,c.[RANK] as rankdegree FROM CONTAINSTABLE( dbo.SearchItems,*,N'FORMSOF(INFLECTIONAL,хорошую)',1000) as c) as ct where rankdegree>0 Table SearchItems contains some Russian text. "хорошую" is a russian adjective which means good. So the problem is t...

Accessing Sql FILESTREAM from within a CLR stored procedure

I'm trying to access a Sql filestream from a CLR stored procedure. I've set up a very simple database with a single table which includes a filestream column. I can successfully read from the filestream using a simple console app. Here's some example code for the proc that fails: [SqlProcedure] public static void GetDataFromFileStream(st...

getting error in SQL Server 2000 but not in SqlServer 2005

Hi, I am executing a stored procedure and i got an error saying 'Error SQL Server Database Error: Error converting data type varchar to int." in sqlserver 2000. But when I execute the same stored proc in Sql server 2005,i am not getting any error and result is getting displayed. Any one is having idea regarding this??Please do help me....

How to pass parameter to FormsOf function in sql server

My problem is similar to this one: I'm having trouble using paramaters in a full-text search with FormsOf(INFLECTIONAL: This query does not return anything. DECLARE @SearchWord nvarchar(4000) SET @SearchWord = 'tax' SELECT listing_id, RANK, name, address, city, zip, heading, phone FROM listings a, FREETEXTTABLE(listings, *, 'FormsOf(I...

how can I store date values partially?

hello, every one i'm using ms sql server 2005 and i need to store date values partially for example, the day part of a date may stay unknown in fact but mssql constrains to specify the full date like the follow: INSERT foo(dt) VALUES('2001-10-31'); though i would like to use something like this: INSERT foo(dt) VALUES ('2001-10-??');...

DTS - Manual step excution gives different results than just hitting "Run"

I have a DTS (not SSIS) package that hasn't been touched in years that I had to update a query with. When I run the package by manually executing each step in the editor, everything works out fine and generates a file of a couple thousand records as expected. When I hit the "Execute" button at the top of the editor to run the whole pac...

sql server invalid object name - but tables are listed in SSMS tables list

I am attempting to create a Stored Procedure for a newly created database. However the SSMS intellisense does not recognize more than half of the tables which have been created. For example whilst in the left hand column under tables I have a table dbo.Room, when I type "dbo." in the new query window, that table is not listed, in fact ...