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

Rewriting 2000 Stored procedure in SQL Server 2008 R2 using Merge

Hello , I'm trying to convert a SQL 2000 stored procedure which Inserts/ updates a target table based on a few conditions , Merge is an obvious choice but have a few issues , there is no similar logic...

View Article


Using Credentials with OPENROWSET

I am trying to use an OPENROWSET to access an excel file that is located on a shared drive in order to import the data. I cannot place the file on the SQL Server Machine, so I need to access using the...

View Article


How to find the unmatched records between the two tables?

We have to tables in SQL Server database. But unable to find the unmatched record betwwen these two tables. There 12 records are unmatched. But unable to get those records. I am using the below sql:...

View Article

Image may be NSFW.
Clik here to view.

total row count get from table two different child table to one master table

Create table #tmp_master (mst_id int ) Create table #tmp_child_one (mst_id int,fname nvarchar(10) ) Create table #tmp_child_two (mst_id int,name nvarchar(10) )insert into #tmp_master select 1 union all...

View Article

SQL Code to Load a Temp Table to Replace xp_cmd_shell

Our area is eliminating xp cmd shell as an option.In what can the following be done without using xpcmdshell.CREATE TABLE #temp(s varchar(2000))      SELECT @cmd_checkfile = 'dir /B "' +...

View Article


String or binary data would be truncated.

I have stored procedure When I execute them with 20000 char in input  that work fine (in stored procedure I declare variable nvarchar(max) ) But when I execute under another procedure with the same...

View Article

Image may be NSFW.
Clik here to view.

Select latest month inventory

Hi,I am trying to select inventory value for the last month for each material. The following is the result set from my query and I want to select only the circled rows (inventory value from latest...

View Article

Optimize a correlated subquery

I have a test subquery here. You can just run it as is in SSMS. I am trying to get a LAST payment date and a and a LAST payment amount and I think I am getting it. The problem is that the way it is...

View Article


problem in Urdu/Arabic data insert in sql server 2005

hii  have trouble to save Urdu/Arabic text in sql table columns when I insert Urdu/Arabic data in sql server 2005 the urdu/Arabic charactor shows as ??? ???????" question mark in the columns. how to...

View Article


how to find where index can be made

Hi,I have pk and fk in the database , i want to find out where i can make some good indexes.(sqlserver 2005)Questions1) Is there any dmv which can help me in finding out where should i make indexs?2)...

View Article

Unable to shrink tempdb

Hi All,This is to bring to your notice that when iam trying to see free space using shrink database it is showing 180GB free space.But when i am trying to shrink individual data files they are only...

View Article

Merge columns

Hi,I have to compare data from 2 tables on 2 different servers with different formats.USE [TestDB] GO /****** Object: Table [dbo].[Table_4] Script Date: 11/20/2013 18:03:47 ******/ SET ANSI_NULLS ON GO...

View Article

execution order - group by and order by

is there any execution order when we use group by and order by together in single query ?

View Article


No lock for updates?

Hi All,We are creating a web application for our end users who are going to enter some data using the UI. Since more than one user is going to be connecting to the application at a time, we are...

View Article

elegant way of carving edit errors off a query resultset

Hi we run enterprise 2012.  I thought this would be the best forum to start with.I have a prototype query that selects data from today's "untyped" (almost everthing is nvarchar) stage table and inserts...

View Article


SQL: System locks up and runs slow after performing simple DML record insert

SQL Version:  2008 R2I am having a serious problem.  I ran the following code to perform a simple table record insert which ran successfully.  However, after running this code I could no longer access...

View Article

SQL: INSERT INTO statement not working

SQL Version:  2008 R2I'm trying to run this code, but it never completes and I have to manually terminate it.  The same thing happens is I only run the SELECT statement portion (without including the...

View Article


The transaction log for database 'mydatabase' is full. To find out why space...

Every time I get this error, at different points of testing inserts and deletions on my table:The transaction log for database 'mydatabase' is full. To find out why space in the log cannot be reused,...

View Article

FailOver Clustering

Experts,We have a fail over clustering High Availability in place. All our instances are 2008R2. We want to install 2012 on all of the nodes in the cluster and create another fail over cluster group on...

View Article

Any one can tell me please learning Projects?

Dear All,I have read lots of books on SQL Server and Visual Studio c#. but still I am unable to work in Visual Studio using c# and SQL server 2012. Any one can tell me any book OR any site where I can...

View Article
Browsing all 23857 articles
Browse latest View live


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