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

Data files move from one drive to another

I have moved the data files like .mdf and .ndf to different location using alter database commant and modify the path,i want to make sure every thing is done well how to do it?k

View Article


Can a list of columns be used with this?

I'm curious if there is a way to pass in a list of column names and possibly table names too instead of just using one of each in the code below.  Thanks in advance for any help!IF EXISTS(select * from...

View Article


Implimenting Type 2 change using Merge Issue

Hi , I'm trying to impliment scd type 1and 2 using Merge statement. I was able to sucessfully test type 1 change but have issues demonstrating type 2 dimension. Business logic says that changes have to...

View Article

Get list of files from the directory using sp_OAmethod

Hi,  how to get the list of files name from the directory using sp_OAmethod or sp_OAgetproperty(scripting.filesystemobject) in sql server 2008. I tried with below query but I'm unable to get the fileid...

View Article

Sum row by row - keep first value to next row and so on

Hi,This my table C1 C2 1 2 2 1 3 3 4 4 5 3 6 1 7 6My expected result is like below table C1 C2 Sum 1 2 2 2 1 3 3 3 6 4 4 10 5 3 13 6 1 14 7 6 20Anyone can help me. Thanks in advance.Regards,Pratheeskkvi

View Article


Query to find First sunday of march and Second Sunday of November in SQL 2008

Hi,I want query to find Second sunday of march and First Sunday of November in SQL 2008. This query can be used for Daylight savings(MST).Thanks in Advance.Regards,LuckyAbdul

View Article

Finding monthly changes in a data set

HelloGiven the below sample table and data, I am after a SQL script that can generate the sample output shown.In a nutshell, I need to identify in a derived column, compared to the previous month,...

View Article

How to handle SQL code for Daylight Savings for MST Time zone

Hi,1. My time zone is MST. My data showing differently as day light saving started from November. Please help me how to handle these issue.2. After Mar 09 2014 Daylight saving going to end.( For this...

View Article


Emailing Session Events for Extended Events.

Hi All,I am using this code for LongRunning Queries.CREATE EVENT SESSION LongRunningQuery ON SERVER ADD EVENT sqlserver.sql_statement_completed ( ACTION (sqlserver.sql_text, sqlserver.tsql_stack) WHERE...

View Article


SQL SERVER USERS

Hello ExpertsHow can we list all sql server users(active or inactive) with the respective rights in a server? i was told to list all users and their rights on a hard copy, thank you as ususa!

View Article

sql query

Hi ,,I have a table with some columns , but am concerned about this column.If you see the values for this column below, the 1st and 2nd, 3rd and 4th ,5th and 6th are actually same..just a number is...

View Article

Execution Plan suggests adding all non key columns in the Create INCLUDE

Hello,SQL Sertver 2008 R2 EP is suggesting to create a composite index with INCLUDE all columns.I have some  basic understanding on INCLUDE when creating an index.I have 70 some columns and  need to...

View Article

ORA-01652: unable to extend temp segment

I know this is an Oracle error message, but bear with me. I moved my SQL server installation from one server to another this weekend. The new server is the exact same configuration, or as close as...

View Article


how to check the previous records and after records

Hello everyone,Need help in the following scenarioEveryday we get blood donations, i need to check the test_results for that donations and needs to update status.JAN  09  statusA   (Here, we dont have...

View Article

getDate() With table functions

Why we cant use get date as parameter for table functionsThanks alot

View Article


probably an easy way to do this using DISTINCT

Hi I am trying to create a stored procedure (SQL query) that returns all columns of a table but only want the rows that are DISTINCT for one column only.  That is I have a column TESTINT with integers...

View Article

How to create a dynamic multi-line function in SQL Server

I am attempting to create a Multi-Line Function in SQL Server that accepts a dynamic WHERE clause as a parameter. I need this so that the function can be as versatile as possible for the filter that...

View Article


Date Column to DayOfWeek Column

Hi.I've got a table that has a Date field in YYYY-MM-DD format and another column called DayOfWeek.  What I want to do is based upon the Date field the tsql will populate the DayOfWeek with the correct...

View Article

avoiding deadlock

I am importing data every hour. There is a dynamic process where dynamically staging tables are created and data is loaded.I  have a small table where i am storing the start time end time and processed...

View Article

Exception handling for all the insert statements in the proc

CREATE PROCEDURE TEST ( @IncrStartDate DATE ,@IncrEndDate DATE ,@SourceRowCount INT OUTPUT ,@TargetRowCount INT OUTPUT ,@ErrorNumber INT OUTPUT ,@ErrorMessage VARCHAR(4000) OUTPUT ,@InsertCase INT...

View Article
Browsing all 23857 articles
Browse latest View live


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