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

Stored Procedure is very slow

I have a stored procedure that is very slow and would like more efficient SQL.  I want to get a selection of data put into a @SearchTbl that I send elsewhere for further manipulation.  I do these in...

View Article


Max of Alpha Numeric string

Hi,There is a collection of AlphaNumeric Version No's available in SQL Table.How to get the Max of all versions?Sample Versions0A1.1.1 A2.2.2 B1.1.0 AA1.1 BB2.2 DD3.3 BB2.3 DD04.3 DD3.4.1a...

View Article


Dynamic Pivot Report

"Hello!! Can anyone suggest how the holidays can be shown in pivot report and the Days dynamically for Days columns?? I have created a report something as follows": Output obtained using union all: (P...

View Article

Insert statement using multiple values without repeating each line

I'm trying to create a Insert statement where it checks to see if a row exists and if not, then the row gets added in but I have one column that changes in each insert line.So for example,DECLARE LName...

View Article

stored procedure return update statemnts / temp table

can a stored procedure return an update statement as outputstored procedure :select BusinessEntityID, into #temp from [HumanResources].[Employee] where jobtitle ='Engineering Manager'o/p :update ph set...

View Article


SQL Server 2014 Exam 70-464 for Developer & Exam 70-465 for DBA?

Exam links:https://www.microsoft.com/learning/en-us/exam-70-464.aspxhttps://www.microsoft.com/learning/en-us/exam-70-465.aspxOr 70-465 is for senior/lead developer?  Or for both senior dev & DBA?...

View Article

How to cross two tables?

Greetings community,This is totally beginner’s question, so accept my apology for bothering you with such a basic thing. At first I blamed Microsoft for giving us LINQ that was so easy to use and on...

View Article

INDEX count not be created

Hi  I could not create index on a table. It shows like this Msg 208, Level 16, State 1, Procedure dba_trigger_log_db_events, Line 58 Invalid object name...

View Article


Image may be NSFW.
Clik here to view.

Removing alpha characters and converting to numbers

Hello. I had a previous post where I referred to this as an Oracle SQL issue when in fact this is a Microsoft SQL question (I am working in SQL Server Mgmt Studio 2012 for this particular...

View Article


More efficient way to do this SQL Procedure

I am creating a stored procedure that is used by another program.  The procedure is very slow for large databases, and I wanted to see if there are suggestions on making it faster.   Each entry in the...

View Article

Add additional fuctionality for SQL copy backup job

I found a good post that queries for the latest backup, and then copies it over to the remote server in preparation for a restore.  It's a batch file that is executed using cmd via sql agent step...

View Article

Executing multiple queries stored in multiple rows

Hi, I have a question. I have a table that contains import scripts for my database. Below is the set up IDTable DateScript 1TableA NULLINSERT INTO [dbo].[TableA] SELECT * FROM OPENROWSET...

View Article

Shared Lock --Blocking Process

Team,I have a sp with dynamic sql, which have around 1500 update stmts.When i run this proc in prod, am getting alerts that this sp is blocking the process in prod server and it shows lock type asLock:...

View Article


Select all items in a category and its sub categories

I have a Categories table and Items table like these:CategoriesCategoryID CategoryName CategoryLevel OrdinalNumber 1 All 0 1 2 iOS 1 2 3 Android 1 5 4 Sub iOS 1 2 3 5 Sub Andoid 1 2 6 6 Others 1 8 7...

View Article

Select all items in a category and its sub categories

I have a Categories table and Items table like these: CategoriesCategoryID CategoryName CategoryLevel OrdinalNumber 1 All 0 1 2 iOS 1 2 3 Android 1 5 4 Sub iOS 1 2 3 5 Sub Andoid 1 2 6 6 Others 1 8 7...

View Article


Image may be NSFW.
Clik here to view.

Unpivot, Pivot without Aggregation

View Article

Check Child Dependency

I am looking for help writing an elegant t-sql query for following scenario: In this scenario I have Task and TaskDependency tables. I would like to get a value of 1, 0, -1 based on the TaskStatus and...

View Article


junction table question

I have 3 Northwind tables, Employees, EmployeeTerritories, and Territories. I have a cross join table between Employees and Territories. I want to add a column to the cross join table. Each row will...

View Article

working days ....

Hi AllI need to create a function that should give today + 10 working days.It doesn't include  week end and the public holidays.Pls could someone help me to create the function.thanks

View Article

Slow query on remote server

HiI am running a query as below;INSERT INTO tblEvents( <fields list> ) SELECT <fields list> FROM OPENROWSET('SQLNCLI', 'Server=<ip address>;DATABASE=MyDB;Uid=sa;Pwd=MyPassword;',...

View Article
Browsing all 23857 articles
Browse latest View live


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