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

All records between given Startdate and Enddate

I have table called tblleavetransaction  EmpID = 431, LeaveFromDate=01-01-2014, LeaveTodate=31-01-2014EmpId                 LeaveFromDate                LeaveTODate...

View Article


How to update sales of last 3 months only

I have a query which basically updates the sales for the whole year, but i just want that one to be changed such that it only updates for the past 3 months,irrespective of the year ( i mean to say if...

View Article


Challenge: Gather execution plans from SQL code

Let's say I have 6000+ sql statements created by our admins over the course of any given year and they're stored in a DB SELECT SQLStatement FROM QueryList OUTPUT: 1  "select * from tbl where" 2...

View Article

how to optimise update query

Hi, If following query, i tried to check the  plan i noticed both where same pls suggest as thum of rule what should be followed. thought i will check plans in each cases. 1) update t1  set a, b, c, d...

View Article

Equivalent of MS Access First Function in SQL for Group By

We previously had an Access database performing operations. We are now converting it over to SQL. There are queries in Access that use the "First" function to insert data, which I have not been able to...

View Article


Returning schema from dynamic aggrigate query

I am creating a database to run aggregate ETLs for end customers.  Customers will put data into a table which will dynamically run the sql and put it into an end table.  The end table name is also...

View Article

Run “USE” with linked server alternatives

I am using SQL server linked servers and find some difficulties while running queries. Below is the actual query.USe testdb SELECT COLUMNPROPERTY( OBJECT_ID('Table_1'),'column1','IsIdentity') It...

View Article

Email Row By Row

Hi Experts ,I have table named Customer with columns namely FirstName,LastName,Email , Priority & DateEvery Monday i need to mail out individual record to the respective customer listed in the...

View Article


Select Rows between given dates

CREATE TABLE #tblleavetransaction (EMPID INT, LeaveFromDate Date, LeaveTODate Date) INSERT INTO #tblleavetransaction SELECT 431, '01-02-2013', '01-04-2013'  --MM-DD-YYYY UNION ALL SELECT 431,...

View Article


Set A SQL Server Field to A DropDown?

How can I set a SQL Server field to be a dropdown?  For example, how can I set a field called DayOfWeek to become a dropdown and only give the options Monday, Tuesday, Wednesday, Thursday, FridayAlso,...

View Article

How to return a different format of datetime type in sql?

hi ,i think this is a dumb question for all of you guys but since i am new here, hope you can help me. here is my problem i have a column in my table that has a namae Date and a type of datetime, what...

View Article

data for two columns are merging automatically

Hi,I have 2 columns like  updatedate  & updatedId.when I am loading my data into table I got o/p as below:It will merging with the columns in ssis.updatedate         UpdatedId20/12/2013...

View Article

SQL Server 2008 | datetime format

How can we change datetime default format to 'YYYYMMDDhhmmss' for all datetime type columns ?Please reply ASAP

View Article


How to convert '20140620' to 'DD-MM-YYYY' formate

Hi Experts,I have data for date fields like "20140620"(YYYYMMDD) while inserting into the table it should be in the format "DD-MM-YYYY"Can any one please help me to achive this.

View Article

Reg : subtracting weekoff day from the time difference

Hi ,I have query where I am getting time difference first of all in terms of hours as:DECLARE @L_TIME_DIFF   INTSET @L_TIME_DIFF= (DATEDIFF(hh, '05/09/2014', '05/12/2014'))i.e. subtracting 12th may -...

View Article


select * from OPENROWSET

 Hello forum, I have a SQL server 2008 R2 database that was upgraded to 2012, a stored procedure that worked well on 2008 R2 now does not work on 2012select*from...

View Article

Move Row from One table to another with extra columns

I am moving a row from one table to another. The columns in the tables are identical except for a couple extra in table 2.I know how to move a row between tables column for column.  How do I populate...

View Article


Combining multiple records into a single record (View)

Okay so here is my scenerio: There is a table I have made that details SQL jobs and the various details about them. What i wan't to do is make a view with specific logic implemented. Fields that will...

View Article

Image may be NSFW.
Clik here to view.

How to assign Unique Number for the result

HiHow can I get Continuous Ranking Number  ( or Unique Number for the result set. )for the below Image.Please kindly excuse me for my bad explanation. SELECT   NTILE (1000) OVER(PARTITION BY...

View Article

Nested functions, Sum of Last(mailboxcount)

Hi,I'm using a query whose output is based on Last(mailboxcount) & it is as follows:ServerMailbox CountABCD2345Based on LAST(mailboxcount)EFGH2234Based on LAST(mailboxcount)IJKL1123Based on...

View Article
Browsing all 23857 articles
Browse latest View live


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