sql-server-2005

Need compare tables utility for SQL Server

Command line or library "compare tables" utility for SQL server with comprehensive diff output to a file in .Net I can't find anything like that. Commercial or free ( XSQL Lite is suitable for my case and ) tools show diffs in grids with possibility to export to CSV. Also they generate sync SQL scripts when run from command line. Wha...

Attaching databases of sql 2000

I have few databses of sql 2000 on windows 2000. Can I attach these databases to another instance of SQL Server 2000 on anothermachine having windows 2003 installed?? Does attach and detach of databases are platform independent?? ...

Cannot resolve collation conflict in Union select

Hi, I've got tqo queries: First doesn't work: select hotels.TargetCode as TargetCode from hotels union all select DuplicatedObjects.duplicatetargetCode as TargetCode from DuplicatedObjects where DuplicatedObjects.objectType=4 because I get error: Cannot resolve collation conflict for column 1 in SELECT statement. Second works: ...

How to run sql from a .net application against sqlserver and get output like with SQL Management Studio?

I'd like my app to run sql files and receive the results output as if the sql was run from SQL Management Studio with results to text. i.e. nicely formatted recordsets, printed messages, rows affected, errors, running multiple batches separated by GO statements, etc. Any suggestions how to do this without building it from scratch on top ...

Asp.net Report Viewer - Custom filter parameters

Hi all, for a data warehouse project I need to know about some best practices regarding custom report viewer filters/parameters. Usually I use the standard parameter feature for reports, like multiple select boxes, check boxes, text boxes etc.. But for the current project some reports require more complex report parameters. E.g. a user...

How do you manage your sqlserver database projects for new builds and migrations?

How do you manage your sql server database build/deploy/migrate for visual studio projects? We have a product that includes a reasonable database part (~100 tables, ~500 procs/functions/views), so we need to be able to deploy new databases of the current version as well as upgrade older databases up to the current version. Currently we...

Full text search involving 2 tables

Hi, I'm very noob in relation to Full Text search and I was told to do a full text search over 2 tables and sort results by relevance. I will look on table "Posts" and table "PostComments". I must look for the search term (let's say "AnyWord") on Posts.Description, Posts.Title and PostComments.Comments. I have to return Posts order by ...

SQL Server 2005 Weird varchar Behavior

This SQL Server 2005 T-SQL code: DECLARE @Test1 varchar; SET @Test1 = 'dog'; DECLARE @Test2 varchar(10); SET @Test2 = 'cat'; SELECT @Test1 AS Result1, @Test2 AS Result2; produces: Result1 = d Result2 = cat I would expect either The assignment SET @Test1 = 'dog'; to fail because there isn't enough room in @Test1 Or the SELECT to...

How to position columns in select list based on a variable.

I am creating a dynamic grid which is created by selecting the format defined in the below XML.My select list includes all columns in this XML,I want to position these columns columns on the basic of position attribute in XML. <gridFormat> <column property="CustomerID" dbName="CustName" HeaderText="Customer" IsVisib...

SSRS Forms Authentication - Report Builder Login

Hello, I'm using SSRS 2005, with custom forms authentication module. That works great. But the report builder prompts for credentials, is there a way to get around this? Is this a configurability thing? Thanks. ...

Insert multiple rows into temp table with one command in SQL2005

I've got some data in the following format: -1,-1,-1,-1,701,-1,-1,-1,-1,-1,304,390,403,435,438,439,442,455 I need to insert it into a temp table like this: CREATE TABLE #TEMP ( Node int ) So that I can use it in a comparison with data in another table. The data above represents separate rows of the "Node" column. Is there an ea...

SQL Server 2005 Database Logfile is HUGE, full

Let me start by saying I am not an SQL or SQL Server expert by ANY means. I know how to create a database and develop a website that uses it. Beyond that, db administration is completely lost on me :( that being said I'm stuck. My log file for two of my databases has grown ridiculously large. One is 650MB, and the other is 16 GB that's ...

ELMAH with IIS6.0 and SQL Server 2005

On production I have ELMAH configured so that the errors are logged into a SQL Server 2005 database created specially for ELMAH. The sites run on IIS6.0 web server. ELMAH is able to send emails for the errors, but nothing is getting logged into the SQL Server database. The connection is a trusted connection and I have <section name="...

Taking Database backup: How to skip '/' from getdate so that it is not considered to be in a folder

I am trying to take database backup. How can I do that when getdate is being appended with file name with format dd/mm/yyyy. declare @dbName VARCHAR(100) declare @path VARCHAR(100) set @dbName='CallMeIndia' set @path='F:\'+@dbName +'-'+convert(varchar(50),getdate(),103)+'.bak' BACKUP DATABASE @dbName TO DISK= @path ...

Performance tune my sql query removing OR statements

I need to performance tune following SQL query by removing "OR" statements Please help ... SELECT a.id, a.fileType, a.uploadTime, a.filename, a.userId, a.CID, ui.username, company.name companyName, a.screenName FROM TM_transactionLog a, TM_userInfo ui, TM_company company, TM_airlineCompany ac WHERE ( a.CID = 3049 )...

Copy 2 databases without detach in SQL 2005

Hello I have a server with live databases, and I have a test-server where I sometimes restore databases from the live one, to get fresh data. But this way I have to set up all the users again, I have about 4 different users with different permissions that need set again. Is there some way to do this a better way without using detach an...

Track Sql server Updation

Is it possible to track the ip address of request which update table in sql server 2000/05? ...

Query to find the records from a table which are updated or added in the last one month ?

Hi, I want to select the records from a table which are updated or added in the last one month (table doesn’t have any datetime field and I can’t change the table structure). Is it possible to write a sql query for that? how to fetch those records from table. regards, kumar ...

Help with complex sql query

To make story short, i'm building self-learning banner management system. Users will be able to insert these banners to their site when banners will be shown based on sales/impressions ratio. I have 4 tables Banners bannerID int bannerImage varchar.... SmartBanners smartBannerID int smartBannerArrayID int bannerID ...

Best Way to call a Web Service from TSQL

Hello, What is the best way to call a Web Service from TSQL? I would Like to write some triggers that call out to a web service. Is there a generally used best practice for this? Implementations would need to be handled in SQL Server 2005 and 2008 ...