Make changes to an SQL Server Table without table re-creation

 

http://www.mssqltips.com/sqlservertip/1903/best-practices-for-sql-server-database-alter-table-operations/

 

Advertisements

Cannot generate SSPI context when connecting to SQL Server when a VPN is connected

We setup a VPN connection to another site, but then programs would not connect to SQL Server using Windows Authentication. We spent a fair bit of time trying to resolve this. Then found the solution, thanks to the following post:


http://www.sevenforums.com/network-sharing/59414-win7-vpn-sql-server-cannot-generate-sspi-context.html

After a lot of searching i found a good solution to the problem when using Windows login to a SQL server while on Win VPN giving the error: Cannot generate SSPI context.
Wanted to share it:

  1. Locate the .pbk file that contains the entry that you dial. Is either: C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Network\Connections\Pbk or if connection is visible to all users: C:\ProgramData\Microsoft\Network\Connections\Pbk (hidden files may need to be disabled first through Organize -> Folder and search options)
  2. Open the file in Notepad using Open with…
  3. Locate the following entry: UseRasCredentials=1 Each VPN connection you have has a section marked with [<VPN connection name>]
  4. Modify the entry to the following: UseRasCredentials=0 Needs to be done for each VPN section for the connections having problems.
  5. On the File menu, click Save, and the click Exit.

Add external access for Lync

When trying to make a Lync IM

http://office.microsoft.com/en-gb/office365-suite-help/let-lync-online-users-communicate-outside-your-organization-HA102837606.aspx

When contacting your support team, reference error ID 1002 (source ID 243). Troubleshooting information is available online, including best practices for using Lync.

In Office 365 Plan E3

  1. Lync Admin Center
  2. Organisation
  3. External communications must turn this on

The other organisation must also have this setting on:

This message wasn’t sent because <recipient>doesn’t have permissions on your organization’s network, or because the address is incorrect. Please contact your support team.

Restart results in reseed of identity by +1000

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

Copied from

http://i.ll.do/2013/01/how-to-solve-sql-server-2012-identity.htm

How to – Solve SQL Server 2012 Identity Problem. Identity increased by 1000 or 10000

Are you experiencing an identity problem with your SQL Server 2012? Do the identity seeds of your records get increased by 1000 or 10000(in my case it was 10000)? Do you wonder why this is happening and how you can solve this? Then keep reading…

Seems like Microsoft has changed the way they deal with identity values in SQL Server 2012 and as a result of this you can see identity gaps between your records after rebooting your SQL server instance or your server machine. There might be some other reasons for this id gaps, but in my case it was an automatic server restart after installing an update.
There are several ways to overcome this issue but here I will explain how I did it, which seemed to be the best way of overcoming this problem.
Below is a quote from a Microsoft post replying to this id crisis issue on “connect”:
If you require the same identity generation semantics as previous versions of SQL Server there are two options available:
•         Use trace flag 272
o This will cause a log record to be generated for each generated identity value. The performance of identity generation may be impacted by turning on this trace flag.
•         Use a sequence generator with the NO CACHE setting(http://msdn.microsoft.com/en-us/library/ff878091.aspx)
o This will cause a log record to be generated for each generated sequence value. Note that the performance of sequence value generation may be impacted by using NO CACHE.
What I did: Setting Trace Flag 272 on SQL Server 2012
  1. Open “SQL Server Configuration Manager”
  2. Click “SQL Server Services” on the left pane
  3. Right-click on your SQL Server instance name on the right pane ->Default: SQL Server(MSSQLSERVER)
  4. Click “Properties”
  5. Click “Startup Parameters”
  6. On the “specify a startup parameter” textbox type “-T272”
  7. Click “Add”
  8. Confirm the changes
Now you should be free of this annoying identity gap problem.

Hope this helps someone.
Good luck, Serdar.

l

VB.Net Get FTP list of files

Code:

Imports System.Net

Public Class FTP1

    Private host As String
    Private username As String
    Private password As String

    Sub New(hostValue As String, usernameValue As String, passwordValue As String)
        host = hostValue
        username = usernameValue
        password = passwordValue
    End Sub

    Function GetFileList() As List(Of String)

        Dim ftp As System.Net.FtpWebRequest = CType(FtpWebRequest.Create(host), System.Net.FtpWebRequest)
        ftp.Credentials = New System.Net.NetworkCredential(username, password)
        ftp.KeepAlive = False
        ftp.UseBinary = True
        ftp.Method = WebRequestMethods.Ftp.ListDirectory
        Dim streamReader As New IO.StreamReader(ftp.GetResponse.GetResponseStream)

        Dim result As New List(Of String)
        Dim line = streamReader.ReadLine
        While Not String.IsNullOrEmpty(line)
            result.Add(line)
            line = streamReader.ReadLine
        End While
        Return result

    End Function

End Class

SSRS Login failed for unattended execution account

SOLVED

> Start > All Programs > Reporting Services Configuration Manager

> Connect

> Execution Account

> Put in new Account + Password

How to copy an ASP.Net web form .aspx

The original page hook up can break

  1. Copy main file
  2. Rename file to remove “Copy of “
  3. View code
  4. Change Public Class name to the new name
  5. Show All Files
  6. Open the <file>.aspx.designer.vb
  7. Rename the class to the new name
    This may clear all errors. If not then continue
  8. If there is code behind then the controls will say “is already declared as..” or “Handle clause requires a WithEvents
  9. View Markup
  10. Change AutoEventWireup=”false” to “true”

 

ASP.Net publish troubleshooting

Was trying to publish to Azure Websites, but it was hanging on “Publish Started”

The Start-up project was another project, so switched it to the website and then published ok. Deliberately switched it back to see if the problem was this and the error returned.

SSIS Troubleshooting

SSIS is case-sensitive and will remember the old column name even if it no longer exists. So say you have a column “CHANGE” and map it through. Then next time you use “Change” then SSIS will try to map “CHANGE” and throw errors. Try changing the column name to something completely different and then map through.

WinForms Designer fails – warning …My.Resources.Resources has no property named … image

SOLUTION from Dave Anson C comment

http://connect.microsoft.com/VisualStudio/feedback/details/540265/designer-fails-warning-my-resources-resources-has-no-property-named

In the project References folder ensure there isn’t a reference to itself. (E.g. You have a project named WindowsApplication1. In the References folder you have a reference to WindowsApplication1)

This worked for me.