Quantcast
Channel: Forum Getting started with SQL Server
Viewing all 8979 articles
Browse latest View live

Linked Server connection timeout

$
0
0

OLE DB provider "SQLNCLI10" for linked server "CHC-SQLREP01" returned message "Protocol error in TDS stream".
OLE DB provider "SQLNCLI10" for linked server "CHC-SQLREP01" returned message "Communication link failure".
Msg 65535, Level 16, State 1, Line 0
Session Provider: Physical connection is not usable [xFFFFFFFF]. 
OLE DB provider "SQLNCLI10" for linked server "CHC-SQLREP01" returned message "Communication link failure".
Msg 65535, Level 16, State 1, Line 0
Session Provider: Physical connection is not usable [xFFFFFFFF]. 
OLE DB provider "SQLNCLI10" for linked server "CHC-SQLREP01" returned message "Communication link failure".
Msg 1236, Level 16, State 1, Line 0
TCP Provider: The network connection was aborted by the local system.

I have a local server in and I connect to linked server but the query times out before completion.

How can get this query completed without timing out?.


How to restore system databases?

$
0
0

If SQL server system databases crash, what will happen?

If sql server system databases crash, how to fix the issue? Any difference to fix for master, msdb,model temp and distribute?

Thanks

Calendar in SQl Server 2008

$
0
0
Hi , I want to print a calendar in SQL Server 2008 based on the Month entered. I should not use date functions, how can i get a calendar without using date functions?
Please help me with the code.
Thanks

Update columns when data is invalid

$
0
0

Hi All,

I got two columns DEATHDATE and STATUS

I have to update STATUS Column as INVALID when data in DEATHDATE column as follows
Example of INAVLID DEATH DATE : 1221, 12xt88,12#10, 1, ABC, #@ , etc


Do nothing when the DEATHDATE is VALID like


Examples of Valid/accepatable DEATHDATE:     91212, 09122012, 091212 ,******,********, 000000,00000000


How can i achieve this.

Adding an image

$
0
0
Hi, I have a pretty simple question. I have a table, and I need one of my columns to be an 'image' column. I've set the column type to 'image', but now I don't know how to actually add images to that column. Can someone please help me.

Creating View Problem

$
0
0
Hi all. I'm new to SQL Server and I've run into a tough problem. I currently have a SQL Server database with 54 US states/territories tables. I'm working on creating a view so that I can view all the states data in a single table-like structure. I've mapped all the columns from all the different tables to their new names and made sure that all the new attributes match. When I use the Management Express tool to open the view, it executes but fails because for some reason it's chosen to map a field called 'id' into an int, rather than a varchar. Is there a way to force the view to treat the 'id' as a varchar and not an int? I can't see a way to change its type through the GUI tools.


What DataType should I use?

$
0
0

I’m wondering what is the best DATATYPE to use to a few fields. This is all stock data; I have one DATETIME field and several VARCHAR(MAX) fields; this is fine. 

I’m just wondering about a few other fields.

I have something called Weight; it looks like this: 0.0055104518

I have something called Weight; it looks like this: 1240298.89

FX Rate could look like either of these: 95.33   or   0.00862701117198

Float could look like this: 20014665.91

Total_MCAP could look like this: 24824167.99

Finally, Index could look like this: 130062.43

 

I’m thinking that all these numeric will be either MONEY or DECIMAL (19,4) or even NUMERIC(19,4). Is that right?  Can someone give me a little guidance on this?

 

Thanks everyone!


Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

Print calendar without using Date functions

$
0
0

IF OBJECT_ID ('dbo.Calendar1') IS NOT NULL
     DROP PROCEDURE dbo.Calendar1
GO

CREATE  PROCEDURE [dbo].Calendar1 --4,1991

 (
   @month int,
   @Year  int
 )
 AS  
 BEGIN
 declare 

 @startdateofMonthYear date,
 @EnddateofMonthYear Date


Set @startdateofMonthYear=(Select cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'01')
Set @EnddateofMonthYear = (SELECT case when @month IN (1,3,5,7,8,10,12) then cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'31'
when @month IN(4,6,9,11) then cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+'30'
else  cast(@Year as varchar(4)) +'-'+Right('00'+Cast(@month as varchar(2)),2) +'-'+(CASE WHEN (@YEAR % 4 = 0 AND @YEAR % 100 <> 0) OR @YEAR % 400 = 0 THEN '29' else '28' End) 
End) 

;WITH CTE_DatesTable
AS
(
Select 1 daysint, Cast(SUBSTRING(cast(@startdateofMonthYear as varchar(20)),1,7) + '-'+CAST(1 as varchar(2)) as DATE) Calendardates

UNION ALL
SELECT   daysint+1,Cast(SUBSTRING(cast(@startdateofMonthYear as varchar(20)),1,7) + '-'+CAST(daysint+1 as varchar(2)) as DATE) Calendardates
FROM CTE_DatesTable
WHERE  daysint<= 
(SELECT case when @month IN (1,3,5,7,8,10,12) then 31
when @month IN(4,6,9,11) then 30
else  (CASE WHEN (@YEAR % 4 = 0 AND @YEAR % 100 <> 0) OR @YEAR % 400 = 0 THEN 29 else 28 End) 
End)-1
 )
Select 
[DWDateKey]=Calendardates,
[DayDate]=daysint,
[MonthNumber]=@Month,
[MonthName]=Case when @month = 1 then 'January'
when @month  = 2 then 'February'
when @month  = 3 then 'March'
when @month  = 4 then 'April'
when @month  = 5 then 'May'
when @month  = 6 then 'June'
when @month  = 7 then 'July'
when @month  = 8 then 'August'
when @month  = 9 then 'September'
when @month  = 10 then 'October'
when @month  = 11 then 'November'
when @month  = 12 then 'December' 
End,
[Year]=@Year

From CTE_DatesTable
END

Above is the code which gives me the calendar, i have not used any date functions in the above code, I am using SQL server 2008 . I should get a week name for the date entered. without using DATENAME function .

Keeping todays date as reference 2/12/2014 it is wednesday.

So is there a way keeping starting date and day as reference adding that in a loop can we get a day??

Plz help i am new to this.

 

bhavana


Prerequisities for Database mail

$
0
0

Hi all,

 I am trying to configure Database mail,is IIS is mandatory ? I configured DB mail,but its not working ?

Any other settings i need to check in WinServer.


Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.

table relationship in VB express

$
0
0
I have 3 tables I am trying to relate for a music player.  I was following the example in the msdn however, my relationships do not seem right.  Here are tables i want to relate:

Table 1:
ArtistID
ArtistName:

Table 2:
RecordingID
RecordingName
ArtistID

Table 3:
TrackID
TrackName
TrackNumber
TrackLocation
RecordingID

So the main idea here is that the foreign keys are recordingId and artistID.  So what i did is created the 3 tables and then make a diagram to create the relationships.  I then was reading this post:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=219696&SiteID=1

What i want to do is use 2 different text boxes lets say and as i move from the records in the Record_table (2) the corresponding artist will change with it.  However in the dataset the relationship looks like this:
Artist -> Recording -> Track.... inorder for me to get this relationship to work correctly i have to change all the relationships in the dataset diagram.  This way the dataset would look like this: Track -> Recording ->Artist.   This way i can use the 2 bindings to reference each other as stated in the link above.  why doesnt the relationship of the database know this already?  why do i have to change the relationship in the datasets.

Could not connect server from client machine

$
0
0

Hi all

I m a new member to this forum. Im a hardware engineer who rectify aome software related issues. Now our employees having problem with connecting their XP prof based clients to 2003 server from SQL query analyzer. I tried refresh sql server manager in server and tried restarting the server machine many times. sometimes it the client machine connects and disconnects immediately. i aslo tried changing the poll interval , but no use.

waiting for a speedy solutin... i know this is as easy query.

 

 

Can NOT login in to SQL2005 with SQl Server Mangement Tool

$
0
0

I get the following error when trying to connect to my server that is on my local maching:

provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233

It happened after I changed the allowed remote connections to 1.  It appears tha I can not log into the server at all.  Any way to fix this besides reinstalling SQL Server?

Thanks, Doug

 

Multiple instances of menu items

$
0
0
When using SQL Server Management Studio Express I get multiples of all the standard Windows menu items as well as in the dropdowns. I have also experienced this in the Visual Basic 2005 Exprerss edition IDE. What is causing this?

Error in Starting Database Mirroring

$
0
0

Hai Everyone.. I have an issue in mirroring which i described below.

I am getting the above error when i click on "start mirroring" button. I turned off firewall in my antivirus. 

And i also executed the below script in both my principal and mirror server. Because i created both the instances in my system only. And i am accessing those instances with windows authentication.

Go
GRANT CONNECT ON ENDPOINT:: EMP1_MIRRORING TO [DEVLAP5170\login];
Go 


-- Thanks and Regards Srikar Reddy Gondesi, Trainee SQL Server Database Administrator Miracle Software systems, Inc.

how to see whether the sql server is clustered or using a local system account?thank u

$
0
0

hi

   may i ask how to see whether the sql server is  clustered or using a local system account?

   thank u very much

best regards

martin


same table for two applications

$
0
0

Hi,

 im using two tables  for two diferent   applications because fields in both applications are common. except in one application has one column extra ClientID

below are two tables

CREATE TABLE [dbo].[EmployeeTSDates](
	[TSID] [int] IDENTITY(1,1) NOT NULL,
	[ClientID] [int] NULL,
	[EmployeeName] [varchar](50) NULL,
	[TSStartDate] [datetime] NULL,
	[TSEndDate] [datetime] NULL,
 CONSTRAINT [PK_EmployeesTable]





CREATE TABLE [dbo].[EmpTimesheet](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ClientID] [int] NULL,
	[EmpID] [int] NOT NULL,
	[EmpName] [varchar](50) NULL,
	[StartDate] [datetime] NULL,
	[EndDate] [datetime] NULL,
	[day] [varchar](50) NULL,
	[date] [datetime] NULL,
	[Service] [nvarchar](max) NULL,
	[Venue] [varchar](50) NULL,
	[Project] [varchar](50) NULL,
	[StartTime] [varchar](50) NULL,


In one applicaion i dont need ClientID so CLientID isalways empty  but in another application it has ClientID =32

below storeprocedure for  without clientid

ALTER PROCEDURE [dbo].[Sp_EmployeeTSDates_InsertGet]@empName varchar(50),
	@tsStartDate datetime,
	@tsEnddate datetime  
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
if exists
	(SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate)
begin 
SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate
end
else
begin 
insert into EmployeeTSDates (Employeename, TSStartDate, TSEndDate) values (@empName, @tsStartDate, @tsEnddate)
SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate

end



END

below procedure wih client ID

ALTER PROCEDURE [dbo].[Sp_AEmployeeTSDates_InsertGet] -- Add the parameters for the stored procedure here @empName varchar(50), @clientId int, @tsStartDate datetime, @tsEnddate datetime AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure here if exists (SELECT TSID ,ClientID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate) begin SELECT TSID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end else begin insert into EmployeeTSDates (Employeename,ClientID, TSStartDate, TSEndDate) values (@empName,@clientId, @tsStartDate, @tsEnddate) SELECT TSID,ClientID from EmployeeTSDates nolock where Employeename = @empName and TSStartDate = @tsStartDate end END

my issue is  do i  need to create another  two more tables(emptimesheet1,emtsdates2) for without clientID application

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider,

$
0
0
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Not getting dbo schema after creating then saving a new table

$
0
0

I am not getting the correct schema once I've created a new table in SQL Server 2005.  I am expecting to see dbo.Table_Name.  Instead I'm getting UserName1.Table_Name.  I was set up as a DB owner.  How can I get what I'm expecting to see?

Can multiple unclustered instances of SQL2K8R2 share the same volume?

$
0
0

Is it possible to install seven instances of SQL Server 2008 R2 on the same physical computer, a standalone, unclustered domain member, and have all seven homed in separate folders on the same volume, like this:

Instance1       Master:    H:\Instance1\Master

                     Data:        H:\Instance1\Data

                     Logs:        H;\Instance1\Logs

                     Temp:       H:\Instance1\Temp

                     Backup:     H:\Instance2\Backup

Instance2       Master:    H:\Instance2\Master

                     Data:        H:\Instance2\Data

                     Logs:        H;\Instance2\Logs

                     Temp:       H:\Instance2\Temp

                     Backup:     H:\Instance2\Backup

Especially, since the H: volume is on a SAN, which may not necessarily enforce the same boundaries as DASD, with each block coming from a different drive.

                     


ASP.NET SQL Server Setup Wizard

$
0
0

Hello, it is urgent 

when i run aspnet_regsql.exe, ASP.NET SQL Server Setup Wizard is opened,  when i add parameters i get this error:

Une erreur s'est produite lors de l'exécution du fichier SQL 'InstallCommon.sql'. Le numéro d'erreur SQL est 207 et le message SqlException est : Invalid column name 'UserId'.

could you help me please?

thx

Viewing all 8979 articles
Browse latest View live


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