sql-server

SQL Server 2008 Performance Question

I have a table with 30 columns and about 3.4 million records. Is it reasonable for SELECT * FROM [Table]; to take 8 to 12 minutes to return all 3.4 million results? If not, where's a good place/resource to begin diagnosing my problem? ...

Help me with my SQL project (please).

Hey everyone, For this grading period, my CS teacher left us a open-choice project involving SQL and Delphi/VB. I ended up with the assignment of designing and building a program that allowed the users to, through a GUI in Delphi/VB, insert and read hurricane data pulled from a database (latest SQL Server, by the way). However, there...

Counts for lots of boolean fields in one sql query?

Not sure exactly how to explain this but Imaging you have a table with lots of boolean fields like this...... Table: Cars Columns: Automatic: boolean Silver: boolean American: boolean Noisy: boolean Smelly: boolean fast: boolean (silly fields and most of them wouldn't be bools in reality but just an examp...

Fast way to eyeball possible duplicate rows in a table?

Similar: http://stackoverflow.com/questions/91784 I have a feeling this is impossible and I'm going to have to do it the tedious way, but I'll see what you guys have to say. I have a pretty big table, about 4 million rows, and 50-odd columns. It has a column that is supposed to be unique, Episode. Unfortunately, Episode is not unique...

SQL Date Format

How do I format a data in SQL to read like this: Monday, November, 23 2009 ...

Find last sunday

How will you find last sunday of a month in sql 2000? ...

dispalying error returned by stored procedure in .aspx form

hey i have a stored procedure which i use to insert values in a table...if i implement error handling in it using @@ERROR and if i it returns error in a variable @myError can i display this error in my .aspx form??i m using sql server 2005 thanx.... ...

Sql Server Login failed for user 'sa'. [CLINET: XXX:XXX:XXX:XXX]

Hi, We installed SQL Server 2005 Enterprise Edition in Windows 2003 with all altest SP for both SQL Server & Windows. SQL Server is running perfectly without any problem for sometime. Suddenly it crashed. when look into EventViewer there per second 5 to 10 entries saying that Login failed for user 'sa'. [CLINET: XXX:XXX:XXX:XX...

SSRS 2005: Group page numbers resetting, view xx from xx

I tried to find any solution, saw a lot of similar questions on different sites, but still have no appropriate solution. So, the situation is following: On SQL Server 2005, Reporting services I have printed form (ex. "invoice"), which can be multi-page. I need to print a lot of such forms (ex. all "invoices" for specified customer and ...

Export multiple queries to different tables

I need to export; Multiple queries to different tables of ms access database from ms sql. I know it is possible by taking each query and export it to a single table and repeating the same for different queries. What i want to know is... can it be done in one stretch? suppose there are three queries and each query output need to be in...

T-SQL stored procedure returns null in code, but works in console

I have a stored procedure CREATE procedure [dbo].[get_unique_identifier] AS DECLARE @ret_val INT UPDATE seq SET @ret_val = id = id + 1 RETURN @ret_val that queries a table (seq) that has a single int column and single row, increments the value and then then returns it. Don't ask why I'm doing this, but in short, the idea is to simulat...

Conversion Deadlock problem, please help!

Hi all, really hope you can help. We've got a problem with conversion deadlocking going on within one environment (the same proc + trigger works in at least four other environments). The stored proc in question inserts a row into a table (cmsreceipt) that has a trigger which updates another table (cmsreceiptarchive). To try and preven...

SQL Server UNIQUE constraint with duplicate NULLs

I have a table where I need to force a column to have unique values. This column must be nullable and by business logic multiple NULL values should be permitted, whereas other duplicate values are not. SQL Server UNIQUE constraint is no good in this situation because it considers NULL as regular values, so it will reject duplicate NULLs...

search all tables, all columns for a specific value SQL Server

I have a specific value let's say string 'comments'. I need to find all instances of this in the database as I need to do an update on the format to change it to (*) Comments. How can I do this? Please help! The database is in SQL Server 2000 format. ...

Help with SQL structure for creating a schedule of notifications

Hi I have the following problem and I am trying to work out what is the best way to solve. I have a table say called [Kpi] and the data would be like this:- [ContractId] [KpiId] [NotificationIntervalInMonths] 1000 1 3 1000 2 5 I have a [Contract] table which contains:- [Contr...

Screencast or video for Database programs in JAVA

Hello, Can someone point me towards a good video tutorial that teaches how to connect to a database (preferrably SQL Server) USING JAVA TO insert data? Thanks ...

Paste into SQL Server table via Management Studio 2005 and keep line endings

I cannot get this to work. I have opened a SQL Server Express table in SQL Server Management Studio 2005. When I try to paste a multiline text snippet into an NTEXT field it gets truncated to only include the first line. In Access these kind of things works, what should i do? ...

Diagnosing WinForms Databinding problem

I'm learning Databinding from here http://www.akadia.com/services/dotnet_databinding.html I'm just updating the dataset and then updating the sql database using sqlDataAdaper.Update(); this.selectCommand = new SqlCommand(); this.selectCommand.CommandType = CommandType.Text; this.selectCommand.Connection = this.connection; ...

How to encrypt all existing stored procedures of a database

Is there any possibility to encrypt all existing stored procedures of a SQL Server 2008 database AFTER they have been created via an SQLCMD script? The reason I want to do this is the following: I'd like to develop the stored procedures without encryption so I can easily click on "Modify" in SQL Server Management Studio to check their c...

JOIN over multiple columns?

Hi folks, I have a database-table with the following structure: id1 | id2 | weight Now I want to sum up the weight for all entries, that have in id1 or id2 a given value. SELECT id, SUM(weight) FROM myTable WHERE id1=@id or id2=@id Usually, I need to get the sum for more than one id. To speed things up, I first load the ids for wh...