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

Problem with Decimal Places and Rounding off

Good Day All  i have a Following Query  1) Query 1 [CODE]DECLARE @FINALVAUE VARCHAR(MAX) =   (Convert(decimal,@CAUSATIVE_FACTORS_ID) - 1) +   Convert(decimal,@LU_PERCENTAGE_FAILURE_IN_SAMPLE_ID) +...

View Article


Optimising a Cursor

Hi,For the following query the estimated execution plan identifies a missing index/* Missing Index Details from SQLQuery20.sql - WCCSQL.TicketorWCC_TEST (sa (107)) The Query Processor estimates that...

View Article


MTD/YTD parameters to a Stored Procedure

Hi guys, I am new to SQL. I know there are plenty of YTD/MTD sql calculations but I have been unable to pass them any of them as parameters to may Stored Procedure.If someone can help me solve at least...

View Article

Common Table Expression Error

I have a requirement to rewrite some of our simple select statement queries using a CTE. And I have had no problems doing so until I encountered one from a query like the one below:USE...

View Article

How can I group student scores into quintile using SQL Server 2008

Can anyone help me to group student scores into quintile. I think there is a feature in SQL Server 2012, but still we are have not upgrade to it as we are using 2008R2. I tried Ntile(5) but it not...

View Article


SP_Rename to rename objects

Hi,I have a table name like 'TEST_24-10-2013.[Employee_2006201_LeftBank]', I want to rename the Object without "[" and "]" in the t bale name. If i use the following syntax, it throws errorNote: the...

View Article

Image may be NSFW.
Clik here to view.

Top-pest parent column should be as new column

Hi,i have a table like below CREATE TABLE #MyTable (ID Integer,Description varchar(200),ParentID Integer) insert INTO #MyTable (ID,Description,ParentID) VALUES (1,'1AAA',0) insert INTO #MyTable...

View Article

LOgin name

Hi Team,Looking output on below with out duplicates Loginname    Login permission Request to you experts please provide the exact script.Thanks in advance. subu

View Article


SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999...

Here is sql Store procedure Create procedure InsertResMasterNEW (         @urm_id int output,          @upm_sector varchar(60) , @upm_block varchar(50) , @upm_plot varchar(50) , @urm_entry_dt datetime,...

View Article


Modify Computed Columns Using T-SQL

Hi,I have a table with 4 columns let us say A,B,C,D.column D is computed column with formula A + '-' + BNow, i want to add one more condition to the formula which looks like "A + '-' + B + '-' +...

View Article

Swapping the first and last characters in a column

Hi,Fairly new to T-SQL and i want to swap the first and last characters in a column.ThanksUmar Javed

View Article

Help on Updating Column

I have a table with below columns and data Subject                                                              DescriptionDC #1 - Emma Andre...

View Article

An update statement to use cumulative columns from the previous record

I need to create a update statement which updates a record based on a column from previous record and its column where they are grouped by another columns and ordered by date in ASC. Note that I need...

View Article


Bringing back specific rows.

Hi SQL Gurus, The first 3 columns are nvarchar(500) and the last one is a column i generated with a LEN function so its an INT and can have NULLs or 0. Below is the sample.  Field2 will be grouped...

View Article

Finidng the missing segments and return to the output

Hello All,I am working on finding the missing segments which doesn't have a code value. I have 2 tables, Line and Code.In the line table I have below columnsLine_ID                  BeginMeasure...

View Article


Is there any other options to CHECKSUM?

For a data cleansing process I'm working on, I'm creating a new key, based on a combination of name + address.I wanted to use something in TSQL that will allow me to create an unique key based on an...

View Article

ObjectID from PageID

Is there any way to obtain the objectID from a DatabaseID & PageID WITHOUT using DBCC Page.I'm returning Data from the Blocked Process Report and want to show which resource is being blocked.For...

View Article


WHERE Clause, IN, Input Parameter

Hi everybodyI have a Stored Procedure with one input parameter called @GL_Code.Somewhere near the end, I use a WHERE clause to filter my data, depending on the value of @GL_Code input by the...

View Article

Query performance tuning

Hello, Can someone please tell me if there is anyway to improve this query to perform better.I tried using temp table instead of CTE .it did'nt change anything.I think there is a problem with latter...

View Article

How can I display previous monthname including the year?

I have the following sql statement:SELECT Cast(datename(month, dateadd(mm, -1, getdate())) as varchar(15)) + '-' + Cast((DATEPART(YYYY,GETDATE())) As CHAR(4))The result displays as July-2014 which is...

View Article
Browsing all 12890 articles
Browse latest View live


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