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

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 Article


How 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 Article


Common 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 Article

DateAdd / 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 Article

sql 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 Article


Data 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 Article

Finding records

  I have exported texr file data to Table Imp  SELECT  BmpShortname,StateAbbreviation,LanduseGroup,Unit  FROM dbo.Imp Result:   Shortname  StateAbbreviation  LanduseGroupUnit PastFenceVAtrpacres...

View Article

How 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 Article


Invalid 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 Article


multiple 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 Article

Change 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 Article

deadlocks 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 Article

Which 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 Article


advantage 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 Article

control 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 Article


Image may be NSFW.
Clik here to view.

Table 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 Article

Cast 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 Article


Two 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 Article

SQL 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 Article

Compare 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
Browsing all 23857 articles
Browse latest View live


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