Quantcast
Channel: SQL Server Database Engine forum
Viewing all 15264 articles
Browse latest View live

Impact of trace flag 272 on SQL Server 2012 apart from disabling identity jump

$
0
0

I am upgrading my application's SQL Server from 2008 R2 to 2012.

As discussed in the below URL I am able to see the Identity jump after I upgrade and the server is restarted.

Now since I cannot afford this and at this moment I do not have the time to create a sequence with NOCACHE and test it again I have to go ahead and add trace flag 272 in the start up parameter as this is the only solution which I can implement and even rollback without much hassles.

http://connect.microsoft.com/SQLServer/feedback/details/739013/alwayson-failover-results-in-reseed-of-identity

I have searched a lot but nowhere I found any kind of documentation around this flag. What I got to know by reading several web literatures is, this flag will disable the new feature of IDENTITY property that has been implemented as part of SQL Server 2012 and will make it work like it was doing in SQL Server 2008 R2.

But I want to know implementing this flag would impact any other feature or performance (except the performance of IDENTITY, that I can bear with) of SQL Server.

Thanks
Soumyadeb


sql server 2012 - cluster and non cluster indexes

$
0
0

Cluster indexes and non cluster indexes takes extra space right?

Is it ok to have only 5/6 non-cluster indexes on tables (not a single cluster index) ?? Will it take more extra space?

I have columns e.g. Invoice no, doc no, customer_id, customer_name, transactionDate etc.

Many times program does cheque with all these columns.  (e.g. where invno = '' and docno='' or refno = '' and customer_id='')

Big reports go by date (that's why date column). 

So coluld't decide which one to make index???

Any suggestions???


h2007

how to find the Domain vise server list

$
0
0

hi team,

i have no.of domain,under domain no.servers are there, here how we can find each domain how server are located.

exp:Domain Name is A

1

2

3 like that....

Constraint for column

$
0
0

Hi All,

I have many columns in my table with numeric datatype(5,2). how can i add constraint for all columns for not exceeding the size 5.

Thanks,

Venkat.

SqlServer 2012 available wait data

$
0
0

Under Sybase, you can query the MDA table monProcessWaits (actually a pseudo table mapped to output from a stored procedure) for cumulative waits and types per spid. So I can query this table every 5 seconds,  for example, and calculate by subtracting current waits from previous waits and current time waited minus previous time waited how long a given spid waited in the period, the type of waits and wait time for each type. This is a powerful capability especially when the wait data can be correlated with other events that have occurred such as slow stored procedures.

The same capability does not seem to exist in Sql Server. The closest thing seems to be sys.dm_os_waiting_tasks which gives you spids that are waiting at a point in time, what they are waiting for, how long they've been waiting, etc. Am I missing anything?

If I were to run sys.dm_os_waiting_tasks every 3 seconds against an Sql Server database from a connected node would I be putting any significant load on the Sql Server instance?

Table structure changing the query plan on a non-clustered index.

$
0
0

I've been trying to understand why SQL server decides build a very complex query plan in some cases. 

I've got two test Tables. 

- Tab1 and Tabx 

When the table only has a single data page the select statement behaves as I would expect and uses the Index efficiently. 

However as soon as there's two data pages pages, the query run against xTab explodes into this:

I'm trying to understand why this is. Below are two test scripts that create the two tables:

CREATE TABLE dbo.Tab1
(
id BIGINT NOT NULL,
Alias VARCHAR(36) NOT NULL,
Version INT,
Locale VARCHAR(5),
Value1 VARCHAR(100) NOT NULL
);

CREATE NONCLUSTERED INDEX [IDX1] ON [dbo].[Tab1] 
(
	[id] ASC,
	[Alias] ASC,
	[Version] DESC,
	[Locale] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO


Truncate table Tab1
Go
DECLARE @i AS int = 1;
WHILE @i < 200
BEGIN
SET @i = @i + 1;
INSERT INTO dbo.Tab1
(id, Alias, Version,Locale,Value1)
VALUES
(@i, 'x', 1,'en-us','Test1');
END;
Go
-- Take a look at how many pages we have
SELECT index_type_desc, page_count,record_count, avg_page_space_used_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(N'Test1'), OBJECT_ID(N'dbo.Tab1'), NULL, NULL , 'DETAILED');


Select 
  Id
From
  Tab1 a 
Where
  a.id = 1
  and a.Alias	= 'x'
  and  (a.Locale = 'en-us' or a.Locale is NULL)
  and a.Version = 1 
Order By Version desc

vs

USE [test1]
GO

/****** Object:  Table [dbo].[xTab1]    Script Date: 09/05/2013 08:56:38 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[xTab1](
	[ObjectPropertyCode] [bigint] IDENTITY(1,1) NOT NULL,
	[ObjectCode] [bigint] NOT NULL,
	[String200Name] [varchar](30) NOT NULL,
	[String200] [varchar](2000) NOT NULL,
	[GroupCode] [bigint] NOT NULL,
	[Status] [char](1) NOT NULL,
	[EntityObjectCode] [bigint] NOT NULL,
	[Type] [varchar](5) NOT NULL,
	[ObjectPropertyAlias] [varchar](60) NOT NULL,
	[TypeObjectCode] [bigint] NOT NULL,
	[Version] [int] NULL,
	[Locale] [varchar](5) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_StringName]  DEFAULT ('') FOR [String200Name]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_String]  DEFAULT ('') FOR [String200]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF__47jectPro__Group__08EA5793]  DEFAULT ((0)) FOR [GroupCode]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_Status]  DEFAULT ('A') FOR [Status]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_EntityObjectCode]  DEFAULT ((-1)) FOR [EntityObjectCode]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_47]  DEFAULT ('') FOR [Type]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_ObjectPropertyAlias]  DEFAULT ('') FOR [ObjectPropertyAlias]
GO

ALTER TABLE [dbo].[xTab1] ADD  CONSTRAINT [DF_xTab1_TypeObjectCode]  DEFAULT ((-1)) FOR [TypeObjectCode]
GO

/****** Object:  Index [IDX1]    Script Date: 09/05/2013 08:51:45 ******/
CREATE NONCLUSTERED INDEX [IDX1] ON [dbo].[xTab1] 
(
	[ObjectCode] ASC,
	[ObjectPropertyAlias] ASC,
	[Version] DESC,
	[Locale] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

Truncate table xTab1
Go
DECLARE @i AS int = 1;
WHILE @i < 101
BEGIN
SET @i = @i + 1;
INSERT INTO dbo.xTab1
(ObjectCode, ObjectPropertyAlias, Version,Locale,String200,GroupCode)
VALUES
(@i, 'x', 1,'en-us','Test1',0);
END;
Go
-- Take a look at how many pages we have
SELECT index_type_desc, page_count,record_count, avg_page_space_used_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(N'Test1'), OBJECT_ID(N'dbo.xTab1'), NULL, NULL , 'DETAILED');


Select 
  ObjectCode
From
  xTab1 a 
Where
  a.ObjectCode = 514345440
  and a.ObjectPropertyAlias	= 'x'
  and  (a.Locale = 'en-us' or a.Locale is NULL)
  and a.Version = 1 
Order By Version desc

Avg. Disk Queue Length

$
0
0

Hi techies, I want your expert comments on the below out put of Avg. Disk Queue Length counter of a server.

MachineName Date Average Minimum Maximum
servername8/2/2013 3:39000
servername9/4/2013 9:011121.75611805039.136279
servername9/4/2013 9:021774.18793705390.97306
servername9/4/2013 9:061588.5293460.0039065176406.338763
servername9/4/2013 9:10167.73224440.003493427649.7818135
servername9/4/2013 9:111107.6406450.000166664941.020105
servername9/4/2013 9:14244.65070730.0025532351135.337003
servername9/4/2013 9:161117.17760.0026467374980.081515
servername9/4/2013 9:211108.0433440.0025934035207.054463
servername9/4/2013 9:221040.7829210.0024465735124.382717
servername9/4/2013 9:239.456722690.00104662633.6021774
servername9/4/2013 9:24119.03352170.001446705729.853147
servername9/4/2013 9:25203.92719350.006779741102.242387
servername9/4/2013 9:261221.7008450.0023400625348.74248
servername9/4/2013 9:271867.810990.0010600286469.5524
servername9/4/2013 9:29179.022856501361.835603
servername9/4/2013 9:3011.12465055094.65123206
servername9/4/2013 9:35398.1327130.0311474991712.072576
servername9/4/2013 9:371340.0389440.0018333825053.418495
servername9/4/2013 9:38221.00524310.0255523521125.273332
servername9/4/2013 9:471970.1671220.0027532286274.132
servername9/4/2013 9:48653.67081490.0287674354496.39807
servername9/4/2013 9:49190.60937880.0012533671333.465446
servername9/4/2013 9:5014.604054360.001353281162.3933974
servername9/4/2013 9:522050.4248090.0046134576690.460893
servername9/4/2013 9:550.5758217540.0010533613.029700913
servername9/4/2013 9:561108.51494505055.222259
servername9/4/2013 9:5872.114326540285.5356821
servername9/4/2013 10:00205.10333320.000380011454.974686
servername9/4/2013 10:04478.108719901825.43821
servername9/4/2013 10:07173.44104170.00276656565.6301265
servername9/4/2013 10:08176.3991450.001173365546.8135302
servername9/4/2013 10:09175.45453070566.7795835
servername9/4/2013 10:10172.98180210.00412011618.3621482
servername9/4/2013 10:15194.77715290.001020027721.4163133
servername9/4/2013 10:16202.27896150.005200139718.7188946
servername9/4/2013 10:20180.02894680.019712576595.507044
servername9/4/2013 10:21115.68391240.004433452452.0425616
servername9/4/2013 10:22104.85189740.002080056711.9677676
servername9/4/2013 10:2493.896954580.008493007494.2756131
servername9/4/2013 10:25162.66928070.025174006742.361386
servername9/4/2013 10:271822.87971105746.61389
servername9/4/2013 10:28340.583593802587.021812
servername9/4/2013 10:30368.44702810.0001466711739.049251
servername9/4/2013 10:321795.20756806643.753873
servername9/4/2013 10:34394.90722880.0362409681416.762777
servername9/4/2013 10:361456.3326680.0073201956748.228723
servername9/4/2013 10:371956.6672150.0044731626690.263668
servername9/4/2013 10:3999.372476570.00200659522.9206921
servername9/4/2013 10:411310.5734560.0040134416509.934172
servername9/4/2013 10:421619.2136910.0057597796582.133399
servername9/4/2013 10:472007.2499540.0052064676629.383452
servername9/4/2013 10:48886.39296950.0280407496006.594107
servername9/4/2013 10:49292.70393930.0093396411395.733315
servername9/4/2013 10:511347.9216220.0075868696499.4756
servername9/4/2013 10:521903.3587590.0032600876339.065273
servername9/4/2013 10:53481.19478240.0259406932607.234824
servername9/4/2013 10:558.6570580180.00080002149.07806404
servername9/4/2013 10:561162.52416505234.356386
servername9/4/2013 10:58206.705356301709.626145

Log shipping Copy Job hangs

$
0
0

Hi,

I have several DBs on 2008 R2 log shipped to DR server. Quite often Copy Job for some DBs can run for days (I assume hangs as normally it completes within minutes). Restart of the Job does not always help. Last message in the Job history is "Coping log backup file to temporary work file". I can see that *.wrk file in the destination folder but the Job does not progress further. 

Thank you in advance for any troubleshooting suggestions or root cause.



Windows user via group membership and sysadmin role for currently connected user

$
0
0

hello,

I am trying to get a list of currently connected user who has sysadmin role. For the Windows login who doesn't have their logins created on the server but are part of Windows group, there seem to be no way to find out whether they are sysadmin or not. I was hoping to join dm_exec_session to syslogins or sys.server_principals view but since the Individual login doesn't exist on the server it comes back with empty row. Does anyone know how to resolve this problem.

I am using SQL 2008 r2.

Thanks for your input.

Kush


Linq Query on execution throwing Exchange Spill error

$
0
0
 

In Our Application while executing one of the LINQ Query we are getting error.

Type: System.Data.SqlClient.SqlException

Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source: .Net SqlClient Data Provider

HelpLink.ProdName: Microsoft SQL Server

HelpLink.ProdVer: 10.00.5829

HelpLink.EvtSrc: MSSQLServer

HelpLink.EvtID: -2

HelpLink.BaseHelpUrl:http://go.microsoft.com/fwlink

HelpLink.LinkId: 20476

Understanding in detailed we found it is due toExchange Spill.

This looks like an optimizer time-out as SQL Server is not able to create an execution plan for the LINQ query.
When the LINQ query is converted to normal query it runs in seconds.
We have a bunch of similar issues in our environment.
Below is the SQL Server profiler output. Please help!


Do we have a fix for the issue or is there a workaround available for this issue.

Appreciate any help on this issue.


Deadlock on table with one row and one primary key clustered index

$
0
0

I have one table with one row in it.

CREATE TABLE [dbo].[SYS_TRAN_ID](
 [NEXT_ID] [dbo].[id] NOT NULL,
 [PROCESS_ID] [dbo].[processid] NOT NULL,
 CONSTRAINT [XPKSTRANID] PRIMARY KEY CLUSTERED
(
 [NEXT_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
END
GO

We occassionaly get deadlocks on this table with multiple SPIDs running this,

update SYS_TRAN_ID
  set  NEXT_ID = ( NEXT_ID + 1 ),
    @newID = NEXT_ID

The deadlock information is,

deadlock-list><deadlock victim="processaa31948"><process-list><process id="processaa31948" taskpriority="0" logused="0" waitresource="KEY: 5:342430164582400 (400041cd0cd1)" waittime="100" ownerId="8034737737" transactionname="UPDATE" lasttranstarted="2013-06-12T08:53:59.330" XDES="0x952a21790" lockMode="U" schedulerid="5" kpid="3204" status="suspended" spid="687" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:53:59.330" lastbatchcompleted="2013-06-12T08:53:59.180" clientapp="CLAIMSTATION" hostname="PC6970A" hostpid="868" loginname="bnahrc" isolationlevel="read committed (2)" xactid="8034737737" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056" databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
  set  NEXT_ID = ( NEXT_ID + 1 ),
    @newID = NEXT_ID     </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645]    </inputbuf></process><process id="process584f948" taskpriority="0" logused="0" waitresource="KEY: 5:342430164582400 (3500ef9ded8d)" waittime="4837" ownerId="8034775524" transactionname="UPDATE" lasttranstarted="2013-06-12T08:54:04.303" XDES="0x2dd548e90" lockMode="U" schedulerid="16" kpid="7232" status="suspended" spid="744" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:54:04.303" lastbatchcompleted="2013-06-12T08:54:04.200" clientapp="CLAIMSTATION" hostname="PC6877" hostpid="5784" loginname="blopmm" isolationlevel="read committed (2)" xactid="8034775524" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056" databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
  set  NEXT_ID = ( NEXT_ID + 1 ),
    @newID = NEXT_ID     </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645]    </inputbuf></process><process id="process5844e08" taskpriority="0" logused="1832" waitresource="KEY: 5:342430164582400 (3500ef9ded8d)" waittime="96" ownerId="8033146025" transactionname="implicit_transaction" lasttranstarted="2013-06-12T08:48:24.597" XDES="0x63ca5b970" lockMode="U" schedulerid="15" kpid="5696" status="suspended" spid="517" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:54:09.070" lastbatchcompleted="2013-06-12T08:54:09.067" clientapp="CLAIMSTATION" hostname="PC9931" hostpid="3912" loginname="daughers" isolationlevel="read committed (2)" xactid="8033146025" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058" databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
  set  NEXT_ID = ( NEXT_ID + 1 ),
    @newID = NEXT_ID     </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645]    </inputbuf></process></process-list><resource-list><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID" id="lockb2e654f80" mode="X" associatedObjectId="342430164582400"><owner-list><owner id="process5844e08" mode="X" /></owner-list><waiter-list><waiter id="processaa31948" mode="U" requestType="wait" /></waiter-list></keylock><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID" id="lock9a2614880" mode="U" associatedObjectId="342430164582400"><owner-list><owner id="processaa31948" mode="U" /></owner-list><waiter-list><waiter id="process584f948" mode="U" requestType="wait" /></waiter-list></keylock><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID" id="lock9a2614880" mode="U" associatedObjectId="342430164582400"><owner-list /><waiter-list><waiter id="process5844e08" mode="U" requestType="wait" /></waiter-list></keylock></resource-list></deadlock></deadlock-list>

Everything I have read thus far deals with update statements with where clauses and using a non-clustered index to cover the query. Can't find anything for my specific example of a table with just a clustered index and no where clause in the update statement. Any suggestions to help this deadlock issue?

sp_UpdateStats missing in database

$
0
0
Hi

We recently installed Lync at our company.
Lync creates 4 SQL instances and I have set up maintenance tasks for these instances.

Strange thing is that sp_UpdateStats does not exist in any of the databases created by the Lync installation.
If I create a new database on the server, I can run sp_UpdateStats with no problem.

I have not found one article out there about anyone having this problem. Strange. Can anyone help?

Server OS: Windows 2012 DataCenter
SQL: 2012 SP1

Please, please can someone help.

Thanks,
TDP

SQL Memory Usage

$
0
0

Hi All

I've been told that when dealing with 64bit SQL Servers with locked pages in memory enabled, using task manager to evaluate how much memory SQL Server is using is wrong.

What is a clear and concise way to retrieve SQL Server's memory usage on a server?

I came across the following script, can someone help me decipher what the columns actually mean?

select physical_memory_in_use_kb/(1024) as sql_physmem_inuse_mb,
locked_page_allocations_kb/(1024) as awe_memory_mb,
total_virtual_address_space_kb/(1024) as max_vas_mb,
virtual_address_space_committed_kb/(1024) as sql_committed_mb,
memory_utilization_percentage as working_set_percentage,
virtual_address_space_available_kb/(1024) as vas_available_mb,
process_physical_memory_low as is_there_external_pressure,
process_virtual_memory_low as is_there_vas_pressure
from sys.dm_os_process_memory

Thanks

Sql Sever Restore error System.Data.SqlClient.SqlError: RESTORE detected an error on page (0:0) in database "test" as read from the backup set. (Microsoft.SqlServer.Smo)

$
0
0

Hi

getting below error in restore SQL Database,

System.Data.SqlClient.SqlError: RESTORE detected an error on page (0:0) in database "test" as read from the backup set. (Microsoft.SqlServer.Smo)

tx

suresh

Invalid object name for user-Defined table type parameter to stored procedure

$
0
0

I have a stored procedure defined with a single parameter whose type is a user-defined data type. On occasion when a call to this stored procedure is made I get an error "Invalid object name @ids". On a particular day I will this error only for a single stored procedure. We don't make any changes to the stored proc, or the C# code, but the next day everything works fine. I have attempted to pass different types of invalid data to the SP, like passing a null, or a table with the wrong data type for the columns, no data, etc. Using SSMS I have attempted to call this SP with different types of data for the parameters but nothing have done seems to generate this error.

My network people assur me that nothing with user permissions is being modified overnight. The SQL admins have checked the sql and system logs and there are no other errors being thrown.

In the SQL Profiler, I see 3 events, RPC:Starting, then SP:Starting, the RPC:Completed with a 1-Error in the error column.
I am tracing sp, rpc and sql statements.

The call to the stored proc is made by calling sp_procedure_params_rowset to get a list of parameters then building the stored procedure call. This is well tested code and always works as expected so I don't think how the stored proc call is built is what is causing this issue.

Any idea what could cause this?

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[pc_ccs_check_ids]
	@ids as dbo.single_id_clustered readonly
AS
BEGIN
SET NOCOUNT ON
SELECT det.id, ch.[level]
FROM @ids det	
INNER JOIN change ch
    on det.id = ch.id
END
GO

Thank you for any help you can provide.

Update PDF file in FileTable

$
0
0

Hi-
I'm new to working with FileTables and am wondering if the following code (which saves annotations to a PDF file in the FileTable with changes that are made through the PDF control) makes sense. My save results are mixed while using the PDF control, depending upon the PDF file that is loaded. If a save is successful, the PDF control will load the PDF file with the annoatations, but the PDF file will not open in Adobe Acrobat (file corruption error is reported).

When using the provided PDFTron sample PDF control project with a file loaded from the file system, no errors are reported when saving annotations to the PDF file, and the changes can be viewed using Adobe Acrobat.

I'm wondering whether my code is generally appropriate, or if I'm going about this all wrong.

        'Create a connection to the database
        Dim ConStr As String
        ConStr = MyAppConnString
        Dim con As New SqlConnection(ConStr)
        con.Open()

        Dim sqlCommand As New SqlCommand()

        ' Set Command text to stored procedure name
        With sqlCommand
            sqlCommand.Parameters.Clear()
            .CommandText = "RetrieveDocument"
            ' Set the command type to Stored procedure
            .CommandType = CommandType.StoredProcedure
            ' Add parameter/s to the command. Depends on the Stored procedure
            .Parameters.Add("@SelectedNode", SqlDbType.NVarChar, 128).Value = myTag
            'add the conection to the command
            .Connection = con
        End With

        Dim filePath As String = CStr(sqlCommand.ExecuteScalar())

        'Obtain a Transaction Context
        Dim transaction As SqlTransaction = con.BeginTransaction("ItemTran")
        sqlCommand.Transaction = transaction

        ' Set Command text to stored procedure name
        With sqlCommand
            sqlCommand.Parameters.Clear()
            .CommandText = "tContext"
            ' Set the command type to Stored procedure
            .CommandType = CommandType.StoredProcedure
            .Connection = con
        End With

        Dim txContext As Byte() = CType(sqlCommand.ExecuteScalar(), Byte())

        'Open and read file using SqlFileStream Class
        Dim sqlFileStream As New SqlTypes.SqlFileStream(filePath, txContext, FileAccess.ReadWrite)
        Dim buffer As Byte() = New Byte(CInt(sqlFileStream.Length)) {}

        'Bind the image data to an image control
        Dim ms As MemoryStream = New MemoryStream(buffer)

        _pdfdoc.Lock()
        Try
            _pdfdoc.Save(ms, SDF.SDFDoc.SaveOptions.e_incremental)
        Catch ex As Exception
            MessageBox.Show(ex.ToString(), "Error during the Save")
        End Try
        _pdfdoc.Unlock()

        sqlFileStream.Write(buffer, 0, buffer.Length)

        'Cleanup
        sqlFileStream.Close()
        sqlCommand.Transaction.Commit()
        con.Close()

Thank you,

Matt

VS 2012 Publisher can not be verified message at install time

$
0
0

Using VS 2012.  How do I get rid of the message PUBLISHER CAN NOT BE VERIFIED at install time.  I also get Unknown Publisher message.  What can I do about both messages?


ecb

Error Connecting to SQLSERVER:SQL as a drive for LocalDb

$
0
0

Please see below.  There is some kind of communication problem when I try to access "(localdb)\Projects" using the ability to connect to SQL Server as a drive, and then ultimately later (e.g. $server = Get-Item .) as a Smo Server object.

With localdb, it fails about 8 times, then suddenly actually works.  It's painfully slow.

I am trying to do this, to, for example, write a script that can unregister a series of DACs all at once, but this is my root problem right now.

Any ideas?

Notice below, on the last line, it finally comes back and works.

Thanks,

Ryan

PS C:\Users\rwhite> cd sqlserver:sql\"(localdb)\projects"
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on '(localdb)' failed with the
following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
PS SQLSERVER:\sql\(localdb)\projects> gci | gm

Install a application on another PC Questions

$
0
0

Using VS 2012.  When I install my VS 2012 application on another PC I get messages about ACCEPTING these two software products (1) MS SQL Server LocalDB and (2) MS Framework.  Is there a way to inform the installer to apply ACCEPT before they get these messages.  Or better do not let the user get these messages?


ecb

Failed to map 16777216 bytes contiguous memory

$
0
0

I am trying to set up a Full Text Catalog on SQL Server 2008 running on Windows Server 2008 R2 Enterprise.

I have created the catalog and added fields to be indexed. However, after a brief attempt at "Populating" the catalog, it then becomes "Idle" with 0 items. When I look at the Error Logs, I see the following error repeated over and over in the SQL Server Log, whenever the catalog tries to populate:

"Failed to map 16777216 bytes of contiguous memory", source being a server process id (spid) in the 20s or 30s. We've recently switched from using SQL Server 2005 to using 2008 for all future work, and this is a brand new database with only a few hundred rows of test data currently. I've created catalogs in the past on our SQL Server 2005 boxes without issue.

I do not have console access to the machine, but according to our sys admin when I inquired about this issue:

"Nothing in any logs except the SQL Logs.   The server is tweaked using SQL Best practice so memory shouldn’t be an issue and it’s not using physical memory excessively at the moment.
 
There are a lot of hits on Google for similar problems but I haven’t seen a valid answer yet."

Thus, I'm turning to you in hopes you may be able to assist, even if simply with more ideas to try.

Thank you in advance.

Viewing all 15264 articles
Browse latest View live


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