Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

why does this trigger find rows when I can't find them?

I've got a trigger that seems to find rows in the INSERTED table when none exist. I can't figure out what's going on. I've got a foreign key defined on PARCEL that does cascading updates on the APPEALS...

View Article


How to check if the file exists or not before bulk insert

How to check if the file exists or not before bulk insert.I would like to skip the bulk insert if the file doesn't exist.Information:I use Stored Procedures to run Bulk insert statement.The stored...

View Article


Using Case in Order by clause

How would I use the Case statement in the Order by clause in this query? The rest of the query works without the case statement. The DDLs are long, so I didn't post them. I think I just need help with...

View Article

More elegant way of writing this query w/o using CTE and variables?

Each CTE returns two values: I divide one by the other and I get a percentage.The query works, but I don't think I need a cte or variables for this.So how can this look more elegant?Thanks.;with cte2...

View Article

Dealing with text, ntext, image pointer problem from VFP

Hi everybody,I had the similar problem before and even documented it in this blog postDealing with the "The text, ntext, or image pointer value conflicts with the column name specified." error from...

View Article


Group by Concatenation of rows in sql server

HiI have tables like belowUSER TABLE_________________________________________________ID   | Name  | Date-----------------------------------------------------------1| A |2| A |3| A |4| B |5| C |6| C...

View Article

Comparing Column Differences

I have a large table with 88 columns (not normalized, yet). I need to list any column differences within this table based upon the unique values (PK)  of DatabaseName, LastName, FirstName and...

View Article

Grouping sequential rows based on a certain criteria

I need some advice on how to handle putting sequential rows in groups based on a certain criteria. I have some rows in a tables structured like this. I have a row number (ordered and sequential), start...

View Article


Transaction in SQL Server

Hello Guys,What is the standardized approach for using transaction in SQL Server?I have a stored procedure that has multiple steps and i want those to be enclosed within transaction.I googled the...

View Article


How do I get Custom Error Messages

I'm using a stored procedure and it checks several things before committing the record, I have each set to generate a different number if an error is raised. How can I get the error in my website and...

View Article

optimize the query

SELECT a.string,a.text,a.code FROM dbo.Property a LEFT JOIN dbo.DimProperty pd ON a.string = pd.string AND a.text = pd.text AND a.code = pd.code WHERE $PARTITION.[PFN_DailyPart](LoadTime) = (SELECT...

View Article

Test

Sorry everyone, but i'm getting errors whenever I try to create a post with a code block in it.  I just want to see if I can post this test message.EDIT:  Actually, can't seem to post XML code, gives...

View Article

Help - Shredding XML

I have a very small XML file (it's a sample file, i'm just trying to learn how to do this right now) which i'm inserting into a table.  Once there, i'm trying to query the file but get an empty result...

View Article


Complex T-SQL Help

Hello,  I have a table customer with the following fields: id,email,CreditScore,CreditScoreDate,Insertdatetime The Email is kind of primary identifier for the table  The Email can be repeated n number...

View Article

How to write a codition based on min rank

Hello All,could you please let me know how to write a codition based on min rank,Create table TableA1 (PatID int, blockName varchar(20), RankID int) insert into TableA1 values (123, 'Cancer', 5) insert...

View Article


Help with a Stored Procedure

I am having trouble with a stored procedure, seen below. The problem I am having is that this stored proc returns the top 2 users across all offices, not by each office which is what I want. The first...

View Article

How does @@TRANCOUNT behave with escalated distributed transactions?

I understand that an explicit declaration of a distributed transaction (BEGIN DISTRIBUTED TRANSACTION) does not change the @@TRANCOUNT return value at all (and correct me if I'm wrong,  because I was...

View Article


SQL Serve 2008 Does Not Return Identity Value

We just upgraded from Windows 2003/SQL2000 to Windows 2008R2/SQL200R2 and we are using a website in classic ASP. We are running into a problem where SQL server stored procedure does not return identity...

View Article

SQL Server 2000 - Where to run the restore command?

Hi there,I have an old server with SQL Server 2000 installed on it.I need to run the restore command (GUI does not work for my purpose) - I do not know where to paste this restore command?I do not see...

View Article

SQL Server 2000 - Restore command specifying the location for mdf and ldf files?

Hi, I have an old server with SQL Server 2000.I have a "c:\db1.bak"  which needs to be restored in such a way that mdf and ldf files are saved in "X:/Data"If someone can please post the command that...

View Article
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>