sql-server-2005

Load a 6 MB binary file in a SQL Server 2005 VARBINARY(MAX) column using ADO/VC++?

How to load a binary file(.bin) of size 6 MB in a varbinary(MAX) column of SQL Server 2005 database using ADO in a VC++ application. This is the code I am using to load the file which I used to load a .bmp file: BOOL CSaveView::PutECGInDB(CString strFilePath, FieldPtr pFileData) { //Open File CFile fileImage; CFileStatus fil...

Synchronize a client database with the central database

I need to update existing data or insert new data from client database say DB1 into central database say DB2 both holding same schema and both databases reside in same machine. The updates are not biderectional. I just want changes to be reflected from client(DB1) to server(DB2). The client database(DB1) is nothing but the backup datab...

SQL/Schema comparison and upgrade

I have a simple situation. A large organisation is using several different versions of some (desktop) application and each version has it's own database structure. There are about 200 offices and each office will have it's own version, which can be one of 7 different ones. The company wants to upgrade all applications to the latest versi...

TSQL: grouping rows on a specific column

SELECT DISTINCT IncreasmentAmount, Name, regionid FROM Pricing.GroupOfRegions WHERE regionid in (6,7) This statement produces this result: 12.80 AB 6 13.00 ABC 6 15.00 AC 6 12.80 AB 7 13.00 ABC 7 I'd like to add more conditions where IncreasmentAmounts are equal. This would result in the rows that...

How to Structure an ASP.NET website with over 1,300 Articles/Quotes

Good Morning All, I have loaded over 1,300 blurbs into my client's database with table schema of BlurbID, Seq, Content, Keywords. A separate database table will contain vote details (voteID, BlurbID, Seq, VoteDate). His intent is to have a blurb website that serves up humorous quotes. Users must vote for the first blurb before being ...

SQL Server 2005 Users & Roles

All, I am trying to script out a database in SQL Server Management Studio 2005. In my database users belong to different roles. Unfortunately I can't find how to script out the relationship between users and roles. Thanks, M ...

Login failed for user 'DOMAIN\MACHINENAME$'

I know this is almost duplicate of : http://stackoverflow.com/questions/1269706/the-error-login-failed-for-user-nt-authority-iusr-in-asp-net-and-sql-server-2 and http://stackoverflow.com/questions/97594/login-failed-for-user-username-system-data-sqlclient-sqlexception-with-linq-i but some things don't add up compared to other appliations...

What is MAXDOP option and Degree of Parallelismin SQL SERVER

Today I was looking into one of the winning solution of TSQL Challenge #20 where I came across the MAXDOP option. It is a new term for me and I made a google search and found this article. But to be honest I could not understand it . Also they are talking about some parallelism and may be these two are interlinked in some way. In simple ...

Not able to add column value

I have project which contain 4 tables among these shedule table Session column i am not able to add vaue,,this table contain three foriegn key from two tables(in which single table has two foreign keys here) i added values here..Any one has any idea about this..Actually my intention is to remove the error "the insert statement conflict...

Question about Reporting and Data Warehousing Software bundled with SQL Server 2005

We currently use SQL Server 2005 Enterprise for our fairly large application, that has its roots in pre SQL Server 7.0. The tables are normalized and designed mainly for the application. The developers for the most part have the legacy SQL Server mindset. Only using the part of TSQL that existed back in 7.0, not using any of the new f...

SSIS: How to transfer data from table A to table B and then update table A flag column for each row

Hi, I need to crate a package in SSIS which will selectively transfer data from Table A to table B based on a flag in Table A and after the transfer update the flag in Table A. Please advice on the approach to this scenario and the different ways in which this can be done effectively. I would also like to mention that i have never wor...

Which is good Pratice storing a uploaded File in DB or storing it in Filesystem

hi I have a File Uploader in my ASP.NET application Using C#, we can upload any type like images, documents, pdf etc. I m storing it in the Filesystem and having only the Name of the File in DB. My doubt is can we store the entire file, images in DB. State me Which is good practice and why we need to use it. Either file System Stora...

Stored proc executes >30 secs when called from website, but <1 sec when called from ssms

I have a stored procedure that is called by a website to display data. Today the web page has started timing out so I got profiler going and saw the query that was taking too long. I then ran the same query in management studio, under the same user login, and it takes less than a second to return. Is there anything obvious that could be...

Synchronizing in SQL Replication works when manually syncing, but not automatically

I'm using SQL Server 2005 to create a replication copy of the main databases, so that the reports can point to the replication copy instead of locking out our main databases. I have set up the 3 databases as publications and then 3 subscribers moving the transactions over to the subscribers, instantaneously I hope! What seems to be hap...

Why Microsoft has put 2 different options for creating Unique Indexes on a table in SQL Server 2005?

Why Microsoft has put 2 different options for creating Unique Indexes on a table in SQL Server 2008? Manage Indexes/Keys : 1 ) type = Unique Key ==> IsUnique = Yes (IsUnique is disabled) 2 ) type = Index ==> IsUnique = Yes Thank you ...

switch case in where clause

hi, i need to check three conditions: if @filter = 1 { select * from employeestable where rating is not null } else if @filter = 2 { select * from employeestable where rating is null } else { select * from employeestable } This i need to do using a case statement. now i have more than 30 lines of query, if i use case i ...

Will creating index help in this case

I'm still a learning user of SQL-SERVER2005. Here is my table structure CREATE TABLE [dbo].[Trn_PostingGroups]( [ControlGroup] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [PracticeCode] [char](5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [ScanDate] [smalldatetime] NULL, [DepositDate] [smalldatetime] NULL, [NameOfFile]...

Problem with update sql with excel

Hi, I have a problem with this query: UPDATE Provinces SET Provinces.DefaultName=T2.Defaultname FROM Provinces INNER JOIN OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\provinces.xlsx;HDR=YES', 'SELECT Code, Defaultname FROM [Arkusz1$]') T2 On Provinces.Code = t2.Code WHERE...

Find out which row caused the error

I have a big fat query that's written dynamically to integrate some data. Basically what it does is query some tables, join some other ones, treat some data, and then insert it into a final table. The problem is that there's too much data, and we can't really trust the sources, because there could be some errored or inconsistent data. ...

In a stored procedure how to run a query and conditionally do something

How would I do this in a stored procedure (SQL 2005): count = select count(*) from table1 where line like '%success%' if count > 0: delete from table1 where not line like '%success%' Thanks for any help. My google skills are really failing me today :-( ...