Tag: sql-server-2005

SQL Temp Tables & Replication

I have had an issue with our replication process and would like to salvage some data. I have a process in place where I will connect to each subscriber before flagging them for reinitialization and I will run the below to pull any data they may have entered in during the “dark time”. I am […]

simple recursive query

I have 2 tables as follows (sample data shown): TableName: A ID Type 1 Bug 2 Requirement 3 Task 4 Specification 5 Bug 6 Specification 7 Production Issue 8 Production Issue 9 Bug 10 Task Tablename: B ID RelatedID 1 2 1 7 5 8 5 4 9 6 9 10 I want to fetch […]

SQL need to subtract certain time from date parameter passed into query

I have a date parameter so the date and time can always change. For this example the datetime is ‘2010-07-06 14:46:37.577’ I need to see how much time is between this date paramter and the time of ’17:00:00.000′ The time of 5PM will never change but as I said the date paramter can change.

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 […]

Can I call a Web Service from SQL Server 2005?

I want to call a web service from my SQL code, but it cannot be using CLR code. Can this even be done?

Linq to SQl Stored Procedure Problem( it can't figure out the return type)

I have this SP USE [Test] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[UsersInsert](@UpdatedProdData XML) AS INSERT INTO dbo.UserTable(UserId,UserName,LicenseId,Password,PasswordSalt,Email,IsApproved,IsLockedOut,CreateDate, LastLoginDate,LastLockOutDate,FailedPasswordAttempts,RoleId) SELECT @UpdatedProdData.value(‘(/ArrayOfUsers/Users/UserId)[1]’, ‘uniqueidentifier’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/UserName)[1]’, ‘varchar(20)’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/LicenseId)[1]’, ‘varchar(50)’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/Password)[1]’, ‘varchar(128)’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/PasswordSalt)[1]’, ‘varchar(128)’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/Email)[1]’, ‘varchar(50)’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/IsApproved)[1]’, ‘bit’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/IsLockedOut)[1]’, ‘bit’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/CreateDate)[1]’, ‘datetime’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/LastLoginDate)[1]’, ‘datetime’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/LastLockOutDate)[1]’, ‘datetime’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/FailedPasswordAttempts)[1]’, ‘int’), @UpdatedProdData.value(‘(/ArrayOfUsers/Users/RoleId)[1]’, ‘int’) Now this SP creates […]

SQL: Best approach to Select and Insert from multiple tables

What do you guys think would be the best approach here? I have about 30 SQL tables that is basically referenced by a [lookup] table. I have to do an insert in another table [FinalTable] for each row in the [lookup] table. Now the [lookup] table looks something like this. ID, Zipcode, tableID 1, 60453, […]

SQL Constraint IGNORE_DUP_KEY on Update

I have a Constraint on a table with IGNORE_DUP_KEY. This allows bulk inserts to partially work where some records are dupes and some are not (only inserting the non-dupes). However, it does not allow updates to partially work, where I only want those records updated where dupes will not be created. Does anyone know how […]

Dynamic ability on creating transformations of data from one set of tables to another on SQL Server

I have a scenario in which i receive files from a source and i blindly dump the data in the files to a staging area DB into number of tables. Now i need to translate the data in the Raw Data tables to a format that my Primary database model would understand and eventually do […]

How to debug TSQL on SQL Server 2005?

How can I debug TSQL on SQL Server 2005 instance? Thanks.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.