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

Complex Pivot Help Needed

I need to convert the data like below for reporting, i have tried a lot but not getting success yet. Original Table: Id || Id1 || Id2 || MasterId || Obs   ||Dec  || Act   || Status|| InstanceId 1  ||...

View Article


Update Trigger and COLUMNS_UPDATED()

Let me rephrase my question:I want to know if there is a faster way (probably using bit operators) to see if COLUMNS_UPDATED() in an update trigger on a table with more than 8 columns contains any...

View Article


How to convert rich text data field to plain text

 I have a database with a field that contains rich text how do I convert it so I can use it in Excel below is what the is looks like.<div>11/7 Walked on to RQAAT</div><div>11/7 RQAAT...

View Article

reading and verifying char in a string

Environment: SQL Server 2008 R2Problem: I am trying to verify whether the following string is valid, which should include only those characters [a,b,c,d,z] in alnegth range between 60 to 65:...

View Article

Bringing back a value that meets a criteria.

Hi,How do i bring back all the fields that only meet the fallowing criteria: Field4 is all NULL. So i would get back all the fields and rows for value (82930017). Thank you for your...

View Article


I need to update the table where I may or may not update all columns, so how...

Hi, I have a table which has some columns, in this table i am trying to update the table which is frequent process. So, here i may update some columns or all depending on my requirement for that...

View Article

How to add numeric Identity (primary key) column in reverse order of an...

I need to add a numeric Identity primary key column (IDcol) to a table which already has an existing numeric column (numCol) which is unique -- but I want to add the Identity column to list in reverse...

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


decrypt date data type

I accidentally used date data type (rather than datetime) to encrypt a column. As I understood from online research, that necessarily entails conversion of the date data type to varbinary(200) to begin...

View Article


Julian Date to Date(time) Conversion

What is the best way to convert Julian date to date (or datetime)?  Thanks.-- Julian to date conversionDECLARE @JulianDate char(7) = '2011099'SELECTCONVERT(DATE,DATEADD(day, CAST(RIGHT(@JulianDate,3)...

View Article

Creating a trigger that will increment a column in one table after an insert...

I want to create a trigger that will increment a number in one column of a certain table after an insertion has been made in a different table. For Example:I have an Employees table that has a column...

View Article

Help needed for solving interesting problem

Hi friends,This is my scenario:We have a table with 980+ columns. For each transaction entered not all columns will contain data, Most of the time for each row there will be having data only in few...

View Article

Distinct Value mapped to multiple customer with single customer name

Hi ,I have a table like belowtblProduct ProductIdProductNametblCustomerCustomerIdCustomerNametblCustomerProductID ProductIdCustomerIdin my case one productId mapped to multiple customer. But i need to...

View Article


Update statement with CASE and banding

Hello Folks,I am stuck and am going nowhere.I have two tables MinuteCategory ------------------MinuteMinuteCategoryMinuteLookup-------------------- MinuteCategoryId (surrogate key) MinuteLow...

View Article

How to delete ALL jobs from sql server?

Experts,Instead of deleting one by one we want to delete ALL at one go, how can we do it?ThanksKumarPlease do let us know your feedback. Thank You - KG, MCTS

View Article


Image may be NSFW.
Clik here to view.

how to update the order from 1 to .... based on start order and end order?

Hello All,I have below table/data structure,DECLARE @TBL TABLE (START_ORD INT, END_ORD INT, ENTITY_NAME VARCHAR(10), ENTITY_ORDER INT) INSERT INTO @TBL VALUES (1, 0, 'ABC', 5), (1, 1, 'ABC1', 8), (1,...

View Article

How to coalesce many rows into one?

I am using SSMS 2008 R2 and am simply trying to coalesce many rows into one. This should be simple I think, but it is currently repeating data in each row. Consider:createtable test( Name...

View Article


SQL server 5 user license issue

i like to know what does it mean that SQL server with 5 user license ? does it mean that only 5 user can conect to sql server at a time with same or different connection string?suppose we have a...

View Article

Splitting a url into it's component parts

Hi,Does anyone know how to split a url into it's component parts using TSQL?I can separate the url into it's root and document library (this is for SharePoint) as followsDECLARE @url  varchar(100) SET...

View Article

How would i create a constraint for date joined which has to be less than...

CONSTRAINT[CK_Member_DateJoined_todayorpast]CHECK(len(DateJoined)<=getdate()[DateLeft]>[DateJoined])I tried this but it will not work someone please help :))

View Article
Browsing all 23857 articles
Browse latest View live


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