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

Which query caused my Hash Match?

Greetings. I'm looking at an exec plan that has a Hash Match close to the top left, consuming 40% of the plan. Hovering the mouse over it doesn't show me which block of code is causing it though. My...

View Article


Image may be NSFW.
Clik here to view.

Update old record

I have a requirement where I need to update the record in mart if the source table record has beedn updated. Right now if we dont get the attribute info for that particular record, I hard cord that as...

View Article


MTD,YTD,PTD without calendar table

          QTY      Month      YearQTY_YTDQTY_MTDQTY_PTD1012010   2022010   2012012   3032012   Above is how my table looks like and  all are having integer datatypesI dont have a calendar table to join...

View Article

How to insert Data from a function on server A into a table on Server B.

Hi, I have a function which is like this DECLARE @oldmax bigint, @newmax bigint SELECT @oldmax = max(exportTimestamp) FROM EXPORT_TIMESTAMPS       IF @oldmax IS NULL SET @oldmax = 0...

View Article

Sql Server Partitioning for Update

hi ... i have created on my sql server database a table that hold transactions on my database , some of updating process take more time for update .my question is is the partitioning for this table...

View Article


Case . . . When . . . Then . . . BULK INSERT

I'm trying to wrap the following in a Stored Procedure:SELECT ( CASE WHEN ( select Count(*) FROM [dbo].[HistoryTable] WHERE MonthlyFileWritten = convert( varchar, dateadd(dd,-1,dateadd(mm,...

View Article

INSERT INTO multiple select and constants

I am trying to do an insert using values from other tables AND constants. I have found partial answer on SO but i can't manage to finish the stored procedure. I should be doing something...

View Article

How to get current month from filename and bulk insert from text file into...

I set up some dynamic SQL to help my bulk copy data from a text file to a table.  This works fine for files that come in every day; I get the previous day’s data, based on the file name that’s placed...

View Article


Transaction History Updates Slow

Hello ...i have created a transaction history table that now contain 10000 row , in some case  i want to delete row , this deletion caused a large number of updates for material and underline other...

View Article


Help with BULK Insert

Hello SQL Buddies,I am trying to run a BULK insert. Here is my code: Code start: use Lagerliste drop table Import use Lagerliste create table Import ( TOTALQTY float null, PARTNO nvarchar (255) null,...

View Article

optimizing the stored procedure

Hi,I am new to the optimizing stored procedureI am posting my procedure, please give me tips to optimize thatSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE procedure...

View Article

Image may be NSFW.
Clik here to view.

Transaction Scope in SQL with same Connection String Multiple times showing...

Hi,Am Using Transaction Scope to Insert to a Master Table and two Sub tables using same connection string.Am opening and closing connection string each time.Method 1. Insert into Master TableMethod 2....

View Article

Part of string Help again

selectreplace(right('BAAU  1864175*2*201312170930*MBNP',CHARINDEX('_','BAAU  1864175*2*201312170930*MBNP')+27),'*','_')It returns the result below1864175_2_201312170930_MBNPThis is the result i want...

View Article


t-sql 2008 r2 cte join with a second table

In a sql server 2008 r2 database, I am trying to take the results of the cte called sProgram and join the results with the Person table in the query. The syntax of the join looks ok, however the...

View Article

Column, parameter, or variable #2: Cannot find data type test_type.

Hello,On SQL Server 2008R2 I receive this error when running the following code:USE [DB1] GO IF NOT EXISTS (SELECT 1 FROM sys.types WHERE name = 'test_context_switch1') CREATE TYPE...

View Article


CASE statement within WHERE clause

i have a select statement like thisHere DateColumn is INT (which is in yyyymmdd format)select x, y , z from table a where CAST( CAST(DATEColumn AS VARCHAR) AS DATE) between      case when a.columnx =...

View Article

Transform xml in column

Hi,I wrote a Clr who returns an SqlXml object that i need to transform,here's the query and the result i haveSelect top 1 id_RefPdr, RefCln, Ncl, IT.dbo.Clr_NclSplitByMask(MasqeTri, Ncl,...

View Article


How to Convert SMO Date property to a SQL DateTime

Hi,I am retrieving the SMO Database CreateDate property and trying to insert this into a T-SQL DateTime column.   The following is a sample of Powershell code to retrieve this...

View Article

SQL-Query-Question: get all ID2 which have specific ID1

Hello,I have a table Tab1 with millions of entries likeID1    ID21       aa 4       aa 1       bb 4       ccI'm looking for a sql-query which gives me all ID2-values which have a all of the supplied...

View Article

General Question

I just joined my company, we are in Healthcare... I wanted to inquire on this issue.We have 3 databases, One is our In house DB, 2nd one is a clearing House and 3rd one is our 3rd vendor.We have a in...

View Article
Browsing all 23857 articles
Browse latest View live


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