Combining sql running job details with running sql processes
HI There,how do i combine sp_who2(programe_name = SQLAgent-TSQL JobStep ) with sysjobs to get name of the job is causing problem??I could see the running jobsExecmsdb .dbo.sp_help_job@execution_status...
View Articlecan a table returned from a udf be just another item in a resultset?
Hi. We run 2012 enterprise. My udf returns a table. Can that table be returned as just another item (but of type table) in the resultset of the query that called the udf? Say without cross apply or...
View ArticleExtract Amount column into positive and negative amount columns
Hi there,I have this sqlselect distinct epstransactions.PatientID, sum(epstransactions.LedgerAmount) from epstransactions inner join EPSReferralKPIs on epstransactions.PatientID =...
View ArticleMax of Sql query
CREATE TABLE [dbo].[S_Products] ( [Serial] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ItemCode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Qty] [float] NULL ) //...
View Articleget row length based on data types
couls you pls share a query which gives the max row size based on the data types of the columns and without any data in the table.this is to estimate the max size of the tables based on the rowsthanks
View ArticleQuery taking too long to execute
I have a query that is taking very long to execute, literally takes more than an hour or two, which is not very productive.I have a primary key on my main table and a foreign key on all LEFT OUTER JOIN...
View ArticleSame Query-Slower Processing
I needed to run a query against 42000 records of data which checks each record and validates it against a number of conditions before flagging it as ok to process or not.Before starting I took a copy...
View ArticleSCHEMABINDING error while using with OPENQUERY
I have a linked server called D20LS and trying to create a view on which pulls the data from the linked server using OpenQuery as shown.(Environment is SQL Server 2012 and Linked Server is pointing to...
View ArticlePerformance Issue with slow running query
Hi all, I have a performance issue that I need help with. The query is taking 40 seconds to run. I tried creating indexes but it hasnt really helped. Please suggest indexes/other methods that might...
View ArticleNeed a that Table Name in Select command which being used in from statement
My Question Is: If my SQL command is like this "Select Code, Name from Customer (Table Name)Can I get this output in this Way .. ?Select Code, Name,Customer(Table Name) from Customer (Table Name)in...
View ArticleSoundex for other languages
I've read where soundex in SQL Server only supports English. We are have an application that we are wanting to implement globally. I'm wondering how others have worked around this issue and if Soundex...
View ArticleDATETIME To Format mm/dd/yyyy hh:mm am/pm
I have a column in a database set as a DATETIME datatype, when I select it, I want to return it as: mm/dd/yyyy hh:mm am or pm. How in the world can I do this? I looked at the function CONVERT() and it...
View ArticleSSMS QUERY
hi ALL,This is my table:-Id Location Date Quantity Starting stck Ending Stck1 Delhi 1/1/2013 52 Delhi 1/1/2013 73 Delhi 1/1/2013 34...
View ArticleHow to identify/troubleshoot - Error SQL72014:.Net SqlClient Data...
How to troubleshoot following error on sql server 2012Error SQL72014:.Net SqlClient Data Provider:Msg 1222, Level 16, state 56, Line request time out period exceeded.Error SQL72014:.Net SqlClient Data...
View ArticleExecuting a Variable in a Stored Procedure containing an Update Statement
Hi,I have created a Stored Procedure, it has one input parameter. Inside the Stored Procedure there are 5 other variables are declared, based on the input parameter 4 of these variables are...
View Articleselect rows from an unNormalized table based on data from a Normalized table
Is there a join type I could use or something else to select rows from an unNormalized table based on the data from a Normalized table? Here are the 2 tables. I want to select the rows from #tmp1...
View Articlestore procedure
Hi all,I have two stored procedure both of them working fine.I want to put their result into a table & join both stored procedure into one stored procedure & in one table as well.Stored...
View ArticleYou do not have permission to use the bulk load statement error
Hi guysI`m getting this error, `You do not have permission to use the bulk load statement.` when running my storedProc from my workstation. If I login to the SQL server itself and run the statement, I...
View ArticleHow do I merge data from table1 on server 1 to final table on server 2 with a...
How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so many hours.
View Articletow left outer join to same table
i am using sql server 2008 and have two tables (family_table) and(children_table) that are related by family_id , How do you count children that havestate 'a' or state 'c' and children that have state...
View Article