how to block the sp result from being displayed, when called from an other sp.
hi,i have a situation, i want to call a stored proc "sp2" in "sp1"sp1 startDeclare @stroutput varchar(max)exec sp2 p1,@stroutputselect @stroutputsp2 endi want @stroutput output form sp2 which i am...
View ArticleHow to get this(Monday,March 25,2013) date format in MS-SQL and in oracle both?
i wanted know How to get this(Monday,March 25,2013) date format in MS-SQL and in oracle both ?
View ArticleCommon Table Expressions
WITH CTE AS (SELECT A.DEPARTMENT_ID, A.DEPARTMENT_NAME, B.ITEM_ID, ITEM_PRICE, B.ITEM_STATUS FROM DEPARTMENTS A INNER JOIN PRODUCTION_ITEMS B ON A.DEPARTMENT_ID = B.DEPARTMENT_ID WHERE...
View ArticleDateAdd / DateDiff: Find the last Tuesday encountered, Find coming Monday
Hi Ladies & Gents, I have a problem where I need to return two dates into variables. I want to return the last Tuesday we have passed through as well as the coming Monday.Caveats (edge cases)a) If...
View Articlesql server 2000:Get the consecutive rows .I have to compare the consecutive...
Below is my table phase structureID Project_ID Phase Updated on Updated by65...
View ArticleData Presentation / Layout Problem
Hi,I'm trying to put together a SQL Query which will produce the data in the following layout:CustomerDateQuantityVolumeDateQuantityVolumeCustomer 1Jan 123344322232Jan 1322334323355Customer 1Feb...
View ArticleFinding records
I have exported texr file data to Table Imp SELECT BmpShortname,StateAbbreviation,LanduseGroup,Unit FROM dbo.Imp Result: Shortname StateAbbreviation LanduseGroupUnit PastFenceVAtrpacres...
View ArticleHow to get Percentage of 2 coulmns in SQL
Hi,I have a table which looks likeName Apple OrangesAbc 10 100XYZ 300 120I want to calculate percentage so it should show me asName...
View ArticleInvalid object name for user-Defined table type parameter to stored procedure
I have a stored procedure defined with a single parameter whose type is a user-defined data type. On occasion when a call to this stored procedure is made I get an error "Invalid object name @ids". On...
View Articlemultiple table join gone crazy
I seem to be getting more data than I need... Basically joining 3 table on a ReceiverID. The first table has one row possible, then the second table could have multiple(many) and the third the...
View ArticleChange date parameters to find data from previous month
hI,I wrote the below SQL query:DECLARE @MINDATE DATETIME DECLARE @MAXDATE DATETIME SET @MINDATE = '2013-08-01' SET @MAXDATE = '2013-08-31' SELECT A.SALESID, A.SHIPPINGDATECONFIRMED, B.CREATEDDATE,...
View Articledeadlocks in sql server 2008 R2
Hi,We have encountered deadlocks issue recently in our production server. I would like to get notified via email when ever deadlock occurs. Can anyone let me know the steps involved in finding...
View ArticleWhich Isolation Level of transaction suit for this Operation (Sql Sever 2005)
sql &= "INSERT into Gss_AC_JVHeader (Acc_No , Acc_SubNo , PlantID) Values (@Acc_No , @Acc_SubNo , 1) " sql2 = "INSERT into Gss_AC_Jv (JvHeader_ID , AC_Code_No , Debit , Credit ) Select...
View Articleadvantage of Global temporary tables? Why we can not use local temporary...
advantage of Global temporary tables? Why we can not use local temporary table in ssis?Global temp table can be accesssed by anyone, It would be problem or not?
View Articlecontrol of flow issue
Hi - Below is some sample code to help demonstrate this dilemma...declare @Type1Orders INT, --1 for yes, 0 for no @Type2Orders INT; --1 for yes, 0 for no set @Type1Orders = 0; set @Type2Orders = 1; IF...
View ArticleTable structure changing the query plan on a non-clustered index.
I've been trying to understand why SQL server decides build a very complex query plan in some cases. I've got two test Tables. - Tab1 and Tabx When the table only has a single data page the select...
View ArticleCast Error Blank Varchar to Datetime
I have a rather large sql statement that was generating the message "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value". I stripped the statement down to...
View ArticleTwo different reports calculating time differrences - same code - different...
I have 2 reports that share common code - they calculate a time difference in minutes - and count the number of items passing thorough a given process during the manufacturing process (Sorry I cannot...
View ArticleSQL Query modified to include a date range instead of a single date.
How should this be written to include the date range 2013-08-01 to 2013-09-06?This is a SQL query to access chat logs in MS OCS.SELECT date, u1.useruri as [from], body, u2.useruri as [to] from...
View ArticleCompare Patient visit times to previous appointment
Hello,I have the following query, this query works well and it used to give me all appointments after the first appointment, i changed the following code frommin(AdmissionDateTime) over (partition by...
View Article