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

column name without space and with sapce

Hi I need your suggestion that it in organisations we are not use any column that contains space in name ?Is it?let sayswe have column name [start time] is not used in organisations only...

View Article


Previous backup time in column

SELECT bus.machine_name AS ServerName, sdb.Name AS DatabaseName, COALESCE(CONVERT(DATETIME, MAX(bus.backup_finish_date)),'Backup Needed') AS NewBackUpTime, CASE WHEN type = 'D' THEN 'Database' WHEN...

View Article

Multiple records based on FIFO

hi,  I need to write sp for selecting some places based on fifo order. My input is quantity so that SP return based on this quantity also. I mean if i give 100 and the first record is 70 only i need to...

View Article

Image may be NSFW.
Clik here to view.

CTE Total count

Hi i have this querySELECT TriageToDoctor, DoctorToBedRequest, BedRequestToDepart,DepartureDate FROM EmergencyDepartment WHERE DepartureDate >=DATEADD(day, -28, GETDATE()) and DepartureMethod...

View Article

SQL Stored Procedure WHERE Statement Script (CM11874)

Good day all,Please may you assist me with the following:I have a script that executes a SP and I get results with 5 rows and a number of columns.How can I execute the SP with a WHERE statement to...

View Article


Not able to use the Query Hint inside the IF Exists clause

Hi there,For one my query i am not able to use the query hint plan inside the IF exists clause. For Example:  IF EXISTS(SELECT 1 FROM Person.Person a INNER JOIN Person.BusinessEntity b ON...

View Article

Image may be NSFW.
Clik here to view.

condition Query check

Create table #temp ( Row_num bigint identity(1,1), Group_namenvarchar(20), default_flag bit, default_value nvarchar(20) ) insert into #temp (Group_name,default_flag,default_value) values...

View Article

Query for

                                                              i.      Daily : Last 24 hours                                                            ii.     Weekly : Last seven days...

View Article


SSIS ,Pass Database name SQL Query from Variable

Hi Experts ,I need to change my Database name in SSIS dynamically . I have seen so many article Online ,But did not get complete Reply step by step. I am working on SSIS 2012 . My Requirement : I need...

View Article


Invalid object name 'sys.dm_db_stats_properties'

Hello all,I am using the following version of SQL Server 2012Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15 Copyright (c) Microsoft CorporationEnterprise Edition (64-bit) on...

View Article

Finding rows from two tables having a common column

I have got two tables. Both the table consists of a common column. I want to find the rows that are there in both the tables for the row. Please help?

View Article

Batch mode in SQL Server column store index

Im trying to learn how to use the column store index, and my problem is that i cant get my queries to run in batch mode, i have followed the tutorial by Eric Hanson but it just wont work! I created a...

View Article

Recursive query on table variable - bottom to top.

Hi All, This is an awkward question, and I really first want to know how viable this is to do in SQL 2005. If it is viable then suggestions on how to approach this. I have a recursive query that...

View Article


Upgrading to 2012 performance problem

Hi Im running a piece of code on a VM which takes just 1 second on our new 2012 box it takes 15 seconds.The execution plan is exactly the same, data is cached so it is all running in memory. Query is...

View Article

Count one row instead of two

Hi,I have the following scenarioOne organisation One publication SubscriptionOne organisation have subscription of one publication from 01-07-2009 to 30-06-2010, then subscription has been renewed for...

View Article


Image may be NSFW.
Clik here to view.

How to return single row based on a column

Dear all,I have the following table dataThis table represent a customer basket where a customer for the same basket can have different PropertyId as hilighted above.I would like to return the basket...

View Article

Recursion using CTE Bottom top Approch

 Hi all,        I need to evalauate 1+.5(1+.3(1+.7))etc. The .5 will be at the top most elements value, the .3 is its child's value and .7 is the childs value. When a new value .8 comes beneath .7 it...

View Article


T-SQL Trigger

Dear fella's,We all know the PLSQL syntax for a trigger when your are dealing with an update/instert/delete WHEN UPDATING('salary') THEN DBMS_OUTPUT.PUT_LINE('Updating salary'); WHEN...

View Article

Going about load testing

Hello all. Im aboutto attempt load testing on an SQL server. I have read a few links and downloaded a few tools. (using SQL Load Generator but please suggest another if there  is better)From the...

View Article

Is there a way to display more results than there are rows?

If I have a table customer with 20 rows, is there a way to get more 20 rows, "faking" the additional ones?Maybe an outer join on itself, using a field of the same type but with different values so you...

View Article
Browsing all 23857 articles
Browse latest View live




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