inserting incremental records in table ?
Hello I want to copy records from another database table to my Employee table i am using below quey to insert records. I have 4k records to insert to destination table but m EMPKEY is giving...
View ArticleColumn data stores in variable
Hi everyone,I want to column level data store in one variable. like below example.
View ArticleHas anyone written a Faceted Search like the ElasticUI interface ... all in SQL?
If you go to dubdubdub elasticui dotcom and look at the bottom-most screenshot, I need to do the equivalent, all in a t-SQL stored proc (addt'l support functions acceptable), and needs to be reasonable...
View Articleissue casting as dollars, etc.
I would like this to output as 1. With Dollar signs2. Thousand separators3. Whole dollars amount with no decimals.Thanks [code language="sql"]cast(L.HTS_Value as money) as [O
View Articlewill this SQL trigger recursive
I am new on writing and testing trigger. I am trying to write a trigger to monitor ta colume wih the table. Wether it is insert or update, if that column has a period there, the trigger will remove...
View ArticleQuery Tuning
Hi,Can you please suggest what can be done to tune the following query ?SELECT A.accounting_program_code ACCT_PGM_CD,
View ArticleSQL Query Help - Separate Column
Hi All:Need help with SQL Query. I have a column named Participants with Names and email addresses in one single column. I want to separate the once with email address in separate column.Participants:G
View ArticleChecking Fulfillment of Prerequisites That Can Contain Elaborate AND/OR...
I am working with a system in which I can query prerequisites for course enrollment in a query like this:[code language="sql"]SELECT [td].[PEOPLE_CODE_ID]&n
View ArticleChange formatting of SSMS generated code
Hi all, not exactly the most pressing query ever, but after all these years I've finally cracked. Is there any way to alter the munged up monstrosity that is the SSMS generated code from the likes...
View ArticleFriday Fun - Excel Formula to SQL Functions
I recently found a nifty Excel Formula that worked out if a datetime was UTC or BST (British Summer time) and adjusted the input accordingly to output UTCHere's the formula, where C3 contains the date...
View ArticleWays of tuning queries on columnstore index (in SQL Server 2014)
Hello,After migrating to SQL Server 2014, I turned one of our large fact tables (2bn rows) into a columnstore index. This has been brilliant - saved loads of disk space, and significantly increased the...
View ArticleHow to create relationship
When I try to create a relationship between modeloptionID in the modeloptions table and "name" in the model table I get the error THE ALTER TABLE statement conficted with the FOREIGN KEY constraint...
View ArticleHopefully an intriguing 'Update' question, for a data cleanse
HI all,I'm cleaning a table with about 2k rows of false data. Basically I have 3 columns as follows:[code language="sql"]CREATE TABLE [dbo].[logs]( [id] [int] NOT NULL, [pro
View ArticleSQL Query Help: Joining on where IN
Easier to demo than explain. Excuse the format, this is my first post.Is it possible to join on a partial match? See below. If i join on like '% + i.equipmentid + %' then i get I could join on 1234567...
View Articleby what size will nvarchar(max) column get stored in LOB_DATA allocation unit?
I have a table defined as follows:[code language="sql"]CREATE TABLETABLE [TestTable] [TestTable]((
View ArticleROWS_PER_BATCH - How does it work in SQL OPENROWSET
Hi,I am using SQL Openrowset to read the file and load the data into a table. The file contains about 150 million records worth data. When I try to load the data the transaction log bloats because of...
View ArticleFor XML Path Returning amp when '&' symbol used in text
Hello there, I've attempted to find some information on the XML path and after a few modifications I still wasn't able to adjust this subselect statement to print the '&' symbol instead of the in
View ArticleAggregate Performance Question
Which approach should I generally take? In this example, I'm keeping it simple, but imagine 20 calculated columns in which I keep summing the same values repeatedly, just in different combinations. Or...
View Article