T-SQL Guru needed! Apply within...
April fools out of the way, now let's find an April genius!The name "April" is derived from the Latin verb "aperire", meaning "to open" in reference to being the season when trees & flowers start...
View ArticleHow do you add a CONSTRAINT for a VARCHAR(10) column to checks the Date...
I have tried: ALTER TABLE dbo.tablename ADD CONSTRAINT DF_Date_format check (SDate LIKE '%[1-2][0-9][0-9][0-9]/[0-1][0-9]/[0-3][0-9]%') ******But this does not work for VARCHAR data type ******** and I...
View ArticleSuprise!-- tempdb is now 500GB!
Hello, A server used for Datawarehousing (and OLTP) often holds surprises and this morning I found tempdb was 500GB (out of 2TB total). Our developers use a GUI-based third-party tool to generate sql...
View ArticleAdventureWorks2014 coming?
I found a reference to: SQL Server 2014 CTP2 In-Memory OLTP Sample, based"Release Notes This sample showcases the new In-Memory OLTP feature, which is part of SQL Server 2014 CTP2. It shows the new...
View ArticlePhysical Temp Table
Hi All,We have SQL Server 2008 SP2 Database. In our database, we have a table which is a Physical Temporary Table. A process inserts huge records into this table, and deletes them after the process...
View ArticleVery Slow Query with CTE inner join
I have 2 tables (heavily simplified here to show relevant columns):CREATE TABLE tblCharge (ChargeID int NOT NULL, ParentChargeID int NULL, ChargeName varchar(200) NULL) CREATE TABLE tblChargeShare...
View ArticleHow to do order by with out breaking the other columns into multiple sets
Hello There,Please help mw with thisi have a table with 500k rows, need to split into 3 sets(please assume need to insert 500k into 3 tables, need not to be exact number of rows in each table) Segment...
View ArticleData Type for saving Base64 image string into SQL database
Hi Team! I have image base64 string to be save into sql database. I use Varchar(MAX) data type. The problem is there are certain image string that cannot be enter (paste) into the table (due to the...
View ArticleConvert minutes to HH:MM
Hi All;belwo is my query to convert minutes to HH:MmCONVERT(float, CAST((appt.scheduleddurationminutes/60) AS VARCHAR(8))+ '.' + CAST(( appt.scheduleddurationminutes%60)AS VARCHAR(2))) as...
View ArticleMost efficient way to return the totalcount along with pagewise data [via...
I have following query to return the page datadeclare @pageSize INT = Null ,@pageNumber INT = Null declare @totalcount int set @pageSize =15 set @pageNumber = 1 select * from (SELECT ROW_NUMBER() OVER(...
View ArticleTrimming string after 3 comma
Hi Guys,I would like to remove string after 3rd comma (including comma). e.g. : 10026102,10027110,20024062,08268932,44535812,59123477,output: 10026102,10027110,20024062Your help will be really...
View ArticleInserting value in the single column table where the only column is a...
Hi,Following is my table definition:create table test1 (col1 int primary key identity(1,1))Now here, the only column col1 in the table is an identity column. Now I want to add explicit values to this...
View ArticleDifference between IN and Exists
What is the Difference between IN and Exists in SQL Server 2005? Give the brief explanation?
View ArticleCalculating very large numbers
I'm trying to calculate a very large number using T-SQL but I am not getting the correct result.The result I'm getting seems to be rounded. I do not want to use the exponential format. declare @test...
View Articlebatchstarting is not fired.
Hi,When I kick-offed a query, I didn't see the batchstarting show up in sql profiler in my QA server until I cancelled query. However if my moved the same query to DEV or production, I could see the...
View Articlequery help
Hii I have two column like Montnumber and Yearnumber I have Data Like this Monthnumber YearNumber 10 2013 11 2012 So Now I want O/P like this MonthNumber YearNumber...
View ArticleBulk Insert Row Terminator issues
Hello,I have a CSV file that I am trying to bulk load into a temp table. The data in the file is all jumbled together, as in, there does not appear to be a row terminator. However, I do see a bunch of...
View Articlecase statement for where clause
Hi Experts,Exclude or include where clause based on parameter value,CREATE TABLE #TEMP ( ID CHAR(1) ) INSERT INTO #TEMP VALUES ( '1' ) INSERT INTO #TEMP VALUES ( '2' ) INSERT INTO #TEMP VALUES ( '3' )...
View ArticleHow to clone a table for testing ?
Hi All, I am trying to test a script on a table and I wanted to make an exact copy of the table and name it differently so I can test my script on the new table Thanks In advance
View Article