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

Get Sequence Number from Scalar Function

I have a scalar function that I would like y'all to critique.  Below is some code to create a test table, insert some data, create the scalar function I use to get the QuoteNumber, select the data...

View Article


Split Range time in seconds (by row)

SQL 2008 R2Hi,I would like to split a time range in seconds by row:The range: 2014-06-01 10:10:27.590 - 2014-06-01 10:10:48.267To be splitted as 2014-06-01 10:10:27.000 2014-06-01 10:10:28.000...

View Article


data conversion and appending

<p>I am working with existing code and am changing the data source for some queries.&nbsp; The original data source had a date field that needs to be compared to another date field.&nbsp;...

View Article

Adding an Apostrophe to a field

I need to add an apostrophe to a field to display in a query. I have a ClientName field and a static value "Order" that I need to concatenate together. For example, if the ClientName is Ben Johnson, I...

View Article

match Pattern in first table

Hi all,    I have a two table .   on based of first table I need to compare second table . like for any elphabets if table 1   data exist then output will be that elpabets.like ,table 11 1 2table21...

View Article


Date Difference for multiple dates

I have a field called 'LOG_COMMENTS' in a table  named T_PRODUCTION_WORK_LOG.In the 'LOG_COMMENTS' whenever a request is placed on hold comments are added by the application, such as 'Status changed...

View Article

Tsql substring / charindex

I have the following text field and am trying to pull the name following "Reviewed By". How can i do this in TSQL? His information looks like:<p>Assessed By: Joe Thomas</p><p>Reviewed...

View Article

CHUNK DATA INSERT

Hello All!I'm inserting a table with millions of records, from another table.  I'm also parsing out some XML data.  My problem is this insert takes hours to do, when I leave for home at night, my...

View Article


Sub Groups

I have a table called bom10500 that looks like the first table below.  What kind of query can I create from this table that gives me a fifth column called "top level" as shown in the second table...

View Article


SQL Server FileStream Performance Issue

I have an application which is generating PDFs & inserting it into SQL using file stream. I am facing performance issue while inserting Filestream data, currently I am able to insert about 7-10...

View Article

Round to nearest 5

I would like to create a UDF that takes a value and returns a number that is rounded up to the nearest value divisible by 5.  For example, if I send it 7 it returns 5, if I send it 528 it returns 530,...

View Article

Join question

I have 2 tables 1 of customers and another of customer orders. I want to get a list of Customers with no orders. In my query I just added a where clause to check "NOT IN" to the customer orders table...

View Article

Updating PK with same value - effect on CASCADE UPDATE

Hello,I would like to understand how sql server 2008 deals with cascade updatesFor example I have Parent table: Employee with column Id as varchar(20) primary key Child table with IdEmployee as...

View Article


Implementing OOP inheritance in T-SQL (not an O/R question)

Is it possible to cleanly obtain the inheritance benefit of object-oriented programming in T-SQL? This is not about O/R mapping, which has been discussed to death all over the web, but rather...

View Article

Merge Help: Output Both Id Fields

I am migrating data from FoxPro to SQL.  Generally easy enough, but the formats are a little different.  So, I dumped FoxPro data into staging tables with SSIS, and now I need to massage the data into...

View Article


How to select the last characters from a string?

I have the following string and am trying to select only the characters before the last "</>".  How can I do this?declare @String varchar(500)set @String = '<p>Assessed By: Michael Jordan...

View Article

Schedule Agent Job as per calendar

Hi All,I have a requiremnt which needs to be automated using Sql Server Agent Job..I am not sure how it can be done.. I have a calendar table which consists 5yrs of dates column.. I need to schedule a...

View Article


master.sys.xp_DirTree

I have 25,000 subfolders under parent directory. when i try to run following query it will not display any folders with 25,000 subfolders but i  run with 2000 subfolders it displays all the subfolders....

View Article

Adding leading 000

I need to add leading zeros, can someone help?Query: cast(pat_hgt_in *0.0254 as decimal(6,3))Current Results: 1.676I need my results to be: 001.676

View Article

SQL Select

I have a table called bom10500 that looks like the first table below.  What kind of query can I create from this table that gives me a fifth column called "top level" as shown in the second table...

View Article
Browsing all 23857 articles
Browse latest View live


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