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

How can I create partitioned table from scratch?

Hi,I would like to create a new partitioned table using this tables couple field will be patitioned function's range.Like (1000+ID)+(YYYYMM of datecolumn)So How can I create partitioned table...

View Article


Within SSMS calculated column changes format of name

I have a column "Name" which is the format John Doe .How would I make my new computed column take this name and make it "Doe, John"?I originally had it splitting the column into First and Last, then...

View Article


Get field names from comma seperated values and match data from diffrent table.

I found a really awsome way to combine comma seperated values like the post here... [How to get comma separated data data from 1 field and find related data from each of the entry to another table?]....

View Article

Can i join a table based on If Condition

select * from abc a join( if @param=1 begin SELECT distinct [Act_ID] FROM [Asses] where [tobacco]=1 end if @param=2 begin SELECT distinct [Act_ID] FROM [Asses] where bariatricsupport=1 end if @param=3...

View Article

Variable value not set?

DECLARE @validation_message NVARCHAR(200) BEGIN SET @validation_message = @validation_message + 'test was here' END SELECT @validation_messageWhat silly mistake am I making?  Why is my variable value...

View Article


current payment due date

I need help with finding the CURRENT_PAYMENT_DUE_DATE after a cutoff date.For example, say a CURRENT_PAYMENT_DUE_DATE was Wednesday, 7/31/2013. The cutoff date is 8/10/2013 and the payment frequency is...

View Article

Image may be NSFW.
Clik here to view.

Dynamic PIVOT by Naomi

Hi,I am using the following Dynamic PIVOT by Naomi,Wow this is great, now what i want to do is add more columnsI can add the new Column, but cannot work out how to input the data, i have tried...

View Article

Email All Insert/Update Rows at the end of the day

Hi Everyone,I have a quick question.  I currently have a SQL trigger that send out an email to the users alerting them when a new record has been add/updated on a table.  This work great I ran into a...

View Article


FullText keyword match

HiI am trying to find exact matches for keywords in resumes using fulltext queries.I am using following queries.  Is it possible to find which keyword(searchterm) matched the search ?I am looking for...

View Article


Argument data type datetime is invalid for argument 1 of substring function.

Hi,I have this query - works fine - ;WITH cte AS ( select * from (SELECT distinct pehPErcontrol ,case left(substring(pehPErcontrol,5,len(pehPErcontrol)),2) when '01' then 'January' when '02' then...

View Article

How to use TSQL to complete the below task...

SELECT Initial.PrismID,  PrismReadingHist.V4, PrismReadingHist.V5, PrismReadingHist.V6,  PrismReadingHist.DateTime , PrismReadingHist.cycle FROM  Initial LEFT OUTER JOIN PrismReadingHist ON...

View Article

Image may be NSFW.
Clik here to view.

Inserting Data into a Table based upon a View

Hi All,OK, I've got an interesting little task and I cannot work how to do it and I am hoping that someone kind enough will help me.So here goes:I have a view called "vwSalesAccSurchSet" within the...

View Article

DBCC CHECKDB error. Internal Database Snapshot cannot be created.

We recently migrated our production server from SQL 2005 (Standard) on Win2003(32-bit) to SQL2012 (Standard; v11.0.3000) on Win2008-R2(64bit). Single-server Dell R510 with 1.2TB storage. Everything...

View Article


"The backup set holds a backup of a database other than existing database....

 I have a problem when i restore my .DAT_BAK file.  I am getting error like "The backup set holds a backup of a database other than existing database.  Restore Database is terminating abnormally".  I...

View Article

Distributing data between given date range

Hi, Let’s assume I have table like below columns & related values.Datebegin can start with any month(& year) & DateEnd could be end with any month(&year)But, here I am doing ascending...

View Article


Generate dynamic sql with cte

Hi, How can generate this SQL from the table @TEMP  ?select * from a select * from b where idA = @idA select * from c where idB = @idB select * from d where idB = @idB AND idC = @idC AND idB = @idB...

View Article

Recompilation and parameter sniffing

Before, I have posted this question to the wrong forum - mirroring. I apologize.In SQL server there is quite often a problem because of parameter sniffing. In average I have SP with at least 5...

View Article


Programmatically schedule a job to run a certain amount of time from now

The application I'm working on needs to interface with an external system that prints physical person identification cards. This interface is implemented through a writeable view. This view has 3...

View Article

Image may be NSFW.
Clik here to view.

Monthly totals listed more than once - need only once

Hi,I have this query that adds the 'current amount' column and sums it by month:--Query Changed to include new codes ;WITH cte AS ( select * from (SELECT distinct pehPErcontrol , DATENAME(MONTH,...

View Article

Help with sql query

I need help on figuring out on how to set a multiplier value from within the query below.  This value is set depending on 2 fields from 2 columns Specie and Thickness.   Thanks YouSELECT [RecordID],...

View Article
Browsing all 23857 articles
Browse latest View live


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