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

DATETIME to DATE...to cast, or not to cast?

Below is a code sample to help ask this question.  There is a DATETIME value that is passed in as a parameter from a report which needs to be put into a DATE datatype.  Both @TestDate1 and @TestDate2...

View Article


SQL2012-Split Functions and Columns

Hi , I am working in SQL-2012 I want to create a SP which Except Single Parameter as String and Split it in multiple Rows , Where Ever New Function comes in Paratemter It should Come in Seperate Rows...

View Article


tsql

i have a table as i will store the column names and there values col_id  columnname                       coulumn_value  1        name,mail_id,phone_no...

View Article

What is fastest way to query table for unique items?

Hi all, I am currently working on a reporting component that queries a table that holds information regarding equipment issues or failure. The UI will provide the user a means to drill down on specific...

View Article

Show only new IDs and then update table so that next time query is run they...

Hi as the title suggest I would like to run a query that only shows New ID's.Here is some test data create table #tmpmerchant (Com_id int not null) insert #tmpmerchant values ('1234') insert...

View Article


Substring change using table valued function

Experts,We have some sample records into address table as:-CREATE TABLE Address_Temp ( R_Id INT NOT NULL, Add1 VARCHAR(100) NULL, City VARCHAR(30) NULL, State VARCHAR(2) NULL, CONSTRAINT...

View Article

Print @SQL_Statement and Merge Join

I'm having some difficulties implementing a Merge via SSMS. I understand the concept, but the real difficulty is deciphering the script of the existing Stored Proc. If I could get the script to print,...

View Article

Image may be NSFW.
Clik here to view.

How to analysis every 5 records twice within an hour and produce the output...

Hi,I have a table which contains the ID and needs to match with a RAW_DATA table to prodcue the data as per attached. Please help on the TSQL can come out the intended result...The program will run @25...

View Article


Select Query ?

HelloI have two tables. tablename: tableAcoulumname: id, studentnamerecords: 1,  nameA             2, name Btablename: tableBcolumname: educationid, studentid, educationrecords:       1,      1...

View Article


how to test for a 2nd space character -- using Case?

create table #tmp1 (fld1 varchar(50)) insert into #tmp1 select 'smith, joe a' union all select 'jones, steve'I need to check if there is a 2nd space in a varchar field.  The first row has 2 spaces ('...

View Article

consecutive rows sql server 2008

Hi,I need to find idno that have policies both with collector 1 followed by collector 2. I need to find the first occurence of each.If a certain IDNO has 2 occurrences of 1,2,1,2 i need to return only...

View Article

Indexes for multiple datetime columns

Hi there, I have a table that has in its structure, start_time_stamp (datetime) and end_time_stamp (datetime)I have created an index with both of these columns as key columns, and a few other fields...

View Article

GROUP BY rows and do mixed aggregation (MIN by different column)

Hi, I have a Problem I don't get resolved. First to the conditions. My table Looks like this:Table ---------------------------------------------------(IDENTITY)    ID                 |      bigint(PK)...

View Article


Image may be NSFW.
Clik here to view.

Microsoft TechNet Wiki Guru - Winners for July!!

The results for July's TechNet Guru competition have been posted!http://blogs.technet.com/b/wikininjas/archive/2013/08/11/technet-guru-awards-july-2013.aspx Congratulations to all our new Gurus for...

View Article

Efficient way to perform calculations on large datasets

Hi, I am using SQL Server 2008 R2, Members table has more than 10 million records and I am working on summarizing all this data for reporting. I need to calculate Sum of AccruedHours, Sum of Amount for...

View Article


CPU is going high in SQL 2000

Friends,1) CPU is going high in SQL 2000 when I run a report.I tuned SP which is running that report, no luck.I see lot of tables with high logical scan fragmentation ... is this the cause?Please help,...

View Article

Image may be NSFW.
Clik here to view.

Manipulating Dates In SQL Server

It's been a while and I have another issue that popped up.I've been tasked to create an analysis of members who have visited an office less than thirty days after their last visit.So, it's like this; I...

View Article


insert

hii need to insert 'please don't'in 1 of my field how to insert don't ,its giving me erroe

View Article

Get duplicate row occurance of different date

Hello,I want to retrieve staff who attend less than 80% for a meeting type assuming we have 10 meetings per list.- The column for Meeting table "Date" means the date that the staff miss the meeting -...

View Article

Find date + month after comparing to another date

I have 2 columns:CutoffDate = '08/03/2013'CurrentDueDate = '05/02/2012' -- this needs to be updated.If the CurrentDueDate > CutoffDate thenCurrentDueDate = The same day of the month following the...

View Article
Browsing all 23857 articles
Browse latest View live


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