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

Return value of sp inside calling sp

I am running SQL 2008R2 and have a stored procedure that does several steps and updating different tables.  I want to run another sp inside this sp and grab the value returned by the Output parameter....

View Article


Fiscal Calendar month

I am trying to create a function within my select statement that will return the fiscal month number. My company's fiscal calendar starts on October 1. The first problem I had is I wasn't sure if there...

View Article


inserting into a not null field

Hello,I'm doing a bulk data insert into a table that includes not nulls and for those fields the source table includes some data in that column that is null.  Is there away to have the script insert...

View Article

SQL Merge Statement Explanantion

Hello Experts,We have an SQL Stored procedure that updates records in a table based with the results from a view.UPDATE RD SET RD.ColA = RTL.COLA,RD.COLB = RTL.COLB FROM dbo.TAB1 as RD LEFT OUTER JOIN...

View Article

how to remove only Comma ( , ) in column ?

example :   Before                         Name                       After                         Name                                        jon,N...

View Article


Pull more than one field into the same field in a report.

I am attempting to put together a report in Visual Studio 2008. It seemed a simple report at first, but as I am creating the SQL, I am having a little trouble conceptualizing how to get it to work...

View Article

Database Backup script

Hi Team,we have two instances. Each instance 30 databases available.Now i want to take all the database backups at a time could you guys please help me to writing a script for this.Thanks in advance. subu

View Article

changing date format from yyyy/mm/dd to mm/dd/yyyy

I use the following statment: MAX(case when A.[NGT_KYC_QUES_PROPERTY]='ResolvedDate' then CAST(SUBSTRING([NGT_KYC_QUES_ANSWER],5,2) + '-' + SUBSTRING([NGT_KYC_QUES_ANSWER],7,2) + '-' +...

View Article


Return 0 count when a Department within a CTE contains records for one set,...

This is a bit of a complicated question to explain, but I am hoping not as complicated to resolve. I will try to describe this generically to allow anybody who can provide a solution to provide a...

View Article


sql server 2012 Logon trigger not working for certain logins

Hello. I created a login trigger to insert data for each login in a table, and it works for all logins except one that is format domain\login and the login ends with the dollar sign(actual name is...

View Article

How can I use Indexed Temp tables to optimize performance?

Instead of joining two CTEs together, I am now going to attempt to join two indexed temp tables. The first temp table is a number of encounters that returns 147 rows in 2 seconds. The second temp table...

View Article

Date Issue

I have a table that contains a column with a part name, the date the price changed, and the amount of the new price. The table may contain the same part multiple times with different dates and prices....

View Article

DATEADD and MAX() not working unless date is hardcoded

Can someone help me understand why using line 13 in the following code returns the wrong LAST_ENCOUNTER_DATE but lines 14 or 15 returns the correct date?  I cannot figure out why the hardcoded date or...

View Article


How to create a temp table in a procedure rather than usinh INTO #temptable

Hello Please.,I am having a quick question to automate something, we have 10 procedures in Sql server 2008 R, each procedure having between 2000 lines to 3000 linesin all procedures the temp tables...

View Article

Get first record value from each group using T-SQL

Hi All,I have one table with 3 columns, say Name  as varchar, ID1 as int, ID2 as int datatypes.Create table:Create table Sample ( Rec_Id Int Not null, Name varchar(30) null, ID1 int null, ID2 int null,...

View Article


Image may be NSFW.
Clik here to view.

Select statement to get all data with the same column value

i have created a page for user to search the sql server.. the search page has 2 dropdown, one is the Entity dropdown containing all the entity_ID in SQL server the other is Business Unit Dropdown which...

View Article

MS SQL Server 2014: Error inserting into Temp table with index and identity...

Dear colleagues,The code below works perfectly fine on MS SQL Server 2008 R2 and MS SQL Server 2012, but gives an error every second time the proc is executed on MS SQL Server 2014. If I do not define...

View Article


Parsing results from sys.dm_exec_sql_text

There may not be a solution to this, but I was hoping that better minds than mine would have a clue:Create a table Customer:create table Customer ([ID] [int] IDENTITY(1,1) NOT NULL, Name...

View Article

Suprise!-- tempdb is now 500GB!

Hello, A server used for Datawarehousing (and OLTP) often holds surprises and this morning I found tempdb was 500GB (out of 2TB total). Our developers use a GUI-based third-party tool to generate sql...

View Article

Distributed transaction using linked server not working in SQL Server 2008 64...

Hi. I have had an issue trying to get distributed transactions to work in SQL Server 2008 using a linked server. The error message I get isOLE DB provider "SQLNCLI10" for linked server "pod1" returned...

View Article
Browsing all 23857 articles
Browse latest View live


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