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

Help with a Query

Hi I have data in the table as follows.CREATE TABLE #Executions ( EventIDINT IDENTITY(1,1),  EventTimeStamp DATETIME,  EventName      VARCHAR(MAX),  EventStatus    VARCHAR(MAX) ) INSERT INTO...

View Article


Convert T-SQL query to DB2 query

I am trying to convert a T-SQL query to DB2 (v.9.7) query but have no luck.I have tested following T-SQL query using query tool of SQL Server Management Studio and it works fine as expected.SELECT CASE...

View Article


SQL to track the changes

HI All,Are there any tables to check the update/inserts/deletes/any activities happened on database? It may be through an application/management studio/any other ETL tool?Basically to track changes...

View Article

master.sys.xp_DirTree

I have 25,000 subfolders under parent directory. when i try to run following query it will not display any folders with 25,000 subfolders but i  run with 2000 subfolders it displays all the subfolders....

View Article

Split list into a table

I'm trying to create a SQL stored procedure that will receive 3 lists from a VBA program.  I want to split the lists whose items are divided by commas and put the list items into a single table that...

View Article


sql server browser start mode issue

I have been searching the web for hours and have found nothing on this. I am using SQL Server 2012 installed on Windows Server 2012 R2 (at least that is my understanding of this).When I go to the sql...

View Article

Select a value at a specified row number

I want to set a variable equal to a value in a table that is at a certain row number.  I don't need an OVER (ORDER BY...) clause, because I want the order to be the order that the values were entered...

View Article

Need some code.

Hi all,my requirement is below,i need to write script .can...

View Article


Image may be NSFW.
Clik here to view.

The time has come! Step up T-SQL Gurus! Your community needs heroes like you!

TechNet Gurus... we salute you!You're awesome, and we know it!Your knowledge uploads and nifty info nuggets are our life blood at TechNet Wiki.Every awesome article that gets an award is just the...

View Article


Image may be NSFW.
Clik here to view.

Display total qty sold of each item of each store

Hi,I have two tables:table 1 - ItemMaster: - Item#table 2 - ItemMovement - Store# - Item# - QtySoldIn order to generate a table showing the totals of each item been sold at each store, could you teach...

View Article

Image may be NSFW.
Clik here to view.

Unpivot, Pivot without Aggregation

View Article

Computed column 'the_column' in table 'the_table' cannot be persisted because...

I am getting the following error when trying to create a table with computed column that points to a function:Computed column 'JobNumber' in table 'SB_B_JobT' cannot be persisted because the column is...

View Article

How to Get Default Value of a Data Type in SQL Query.

Hi all,I am creating a procedure which will take input the table name and Column Name.In the Output i would like to have the data type and default value of that data type which will be used by a...

View Article


SQL Server Management Studio experiences lock timeout when using SELECT INTO

Whenever I execute a long-running SELECT INTO statement and while it is running I try to use the SQL Server Management Studio object browser to view tables or other objects, I get a lock timeout error....

View Article

How much do CAST statements affect performance?

I have an 800+ line SELECT that I am tuning before using it as the source in an SSIS package. I have reduced the original time it took from around 19 minutes down to just under 2 minutes and now I'm...

View Article


Creating Max Querry

I am looking to create query to find a Maximum value in a column called "total_full_energy_b" between the dates of X and Y.  The dates are all sent and live in column "cdate".  Any help would be...

View Article

Insert of data getting missed/duplicated while using Cursor

Hi all,Greeting !! I got a strange issue with cursor usage in a SP . Below is the cursor detail.Basicially the SP pulls around 2,25,000 records to a temp table(#TMP_ADJ) from there cursor picks and...

View Article


How to detrimine date duration, minus weekend days and days on hold

I need to determine duration of a request by when the request went from Milestone_ 3 to Milestone_8 (but if Milestone_8 is null use Milestone_7) minus weekend minutes.But I also need to find the days...

View Article

Conversion failed when converting the varchar value '5,6' to data type int.

Hi,I am running the query below and it is throwing the following error:  "Conversion failed when converting the varchar value '5,6' to data type int."  I am thinking it has something to do with the IN...

View Article

Bucket data

Dear All,I have a table  with 80104948 records , i want to equally place the data in 10 filegroups, each filegroup will have 80104948 /10 =8010494 rows.How can i achieve this? Mohd Sufian...

View Article
Browsing all 23857 articles
Browse latest View live


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