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

Select distinct top 3 from table

in my sql table named staff there is a field named PL. sampl data is as underPLKMKTKMHGTGHGi tried select distinct top 1 PL from staffi got top 1 i want top 1then top 2 onethen top 3 one then top 4 one...

View Article


How much Memory should be allocated to SQL Server 2005

Hi,I have a SQL Server 2005 installation on a server having 64GBof RAM. SQL server is allocated 57GB of the available RAM.Could you please tell me what would be the ideal RAM allocation for my...

View Article


INSULL(Column1,'') Make a new system function like ISNULLEMPTY(Column1)

INSULL(Column1,'')     The above function has been greatly used in TSQL and PLSQL.Make a new system function like ISNULLEMPTY(Column1)

View Article

genrate date series

Hi allI have start date and end ateI need a date column based on this. Like desired output will bestartdateenddate02/01/1102/04/1103/01/1103/07/1104/01/1104/03/11Please help....

View Article

T-SQL Query help

I Have table like CustName GroupName Joining Date AAAA G1 1-Jan-00 BBBB G2 1-Feb-06 CCCC G3 1-Mar-08 DDDD G1 1-Mar-10 EEEEE G2 1-Mar-11I have to develop report displaying customer relationship length...

View Article


ANSI_NULLS NOT IN Query

Hi,Why does the below only work when ANSI_NULLS is set to OFF?Thanks!WHERE r.PositionID + @User NOT IN (SELECT v.PositionID + v.User FROM ValidData v WHERE v.AccDate = @AccDate AND v.User = @User)

View Article

Help with a whereclause that filter out values so max changes

I don't really need specific sql, but I just need a general direction for how to proceede.To simplify the problem then I have a table with 3 fields: BaseId, Id and StatusId.The same baseId will have...

View Article

Error while creating view

 Hello,I am trying to create view which is based on multiple source tables and I am receiving following error Internal error: An expression services limit has been reached. Please look for potentially...

View Article


Query Help!!!

How can i get the values in a string like this:ABC_BCD_SDB_KLJI need the values ABC BCD SDB KLJ in different columns..

View Article


Random Values

Hi all, I would like to insert random values between the range of specific condition.Lets say I am passing in a Max Value of 5,000,000 and a Min value of 1,000,000 I want to generate Random values...

View Article

ignore query hints?

Is there a way to ignore all query hints? SQL 2008 R2. Thank youPaula

View Article

invalid object name 'sys.objects'

Our scripts have a sql server 2005 requirement.Some of our customers have reported the error invalid object name 'sys.objects' . On going through some of the posts in this forum it seems to me that...

View Article

Email alerts for Sql Server Database

Is there anyway I can create trigger or any email notification after any changes made in Database for example after any changes in stored Proc, function, views.

View Article


Random Dates

Hi all, I would like to insert random dates between the range of specific condition.Lets say I am passing in a Max Value of 12/12/2014 and a Min value of 01/01/2014 I want to generate Random dates...

View Article

How to use concatenate values into the newly added column with semicolon...

Hi AllGreetingsI have created a new column "EmployeeInfoDetail" in my existing tables. I need to Insert value in this new column based on different colums values from another table . i have total 4...

View Article


Parsing a text file to a sql table

Can you help me parse a txt file to a SQL table. Here is the exact format of the txt file... with the no space between the FreqDiff:#Time; SampleNum; SampleId; Moisture; Solids; Weight; Water;...

View Article

Tsql View Script help

Hello Forum Members,CREATE TABLE #Temp_Actual( [City] [nvarchar](255) NULL, [Sales] float Null, [Act_Date] [datetime] NULL  )Insert into #Temp_Actual values ('Seattle',12,'12-January-2014') Insert into...

View Article


Changing Database Name Dynamically Using Code\Variables

I have SQL where I am trying to change to a different database dynamically inside a cursor or while loop:DECLARE @SQL nvarchar(2000) DECLARE @DBName sysname SET @DBName= 'Datasets' SET @SQL = 'USE ' +...

View Article

Creating multiple views in SQL Server 2008 database through sqlcmd

I've written a script that generates a ddl file. The ddl file contains all the table creation, view creation and stored proc creation SQL statements for refreshing my database. The ddl file gets run by...

View Article

Create a view with calculation.DATEDIFF? How?

Hi, i have tables Receipt and Rent. the database is for rent a car company. in the  Receipt  table i have Total Cost and in the Receipt table Rental Date and Return Date. I want to create a view from...

View Article
Browsing all 23857 articles
Browse latest View live


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