sql-server

If I have a table with only an auto-increment column, how do I insert into it?

A colleague asked me, if you have a table in SQL Server with only an auto-increment column, how do you insert a new row into that table? INSERT INTO MyTable() VALUES() ...doesn't work. As for why... I'm not really sure. But I found the question kind of compelling. ...

Is it possible to export my SQL replication definition to XML?

I was asked to do this, but I don't know if there is a standard way of doing so. Does anyone know if there is a way in SQL Server to export this? ...

Can replication work between SQL 2005 publisher and SQL 2008 subscriber?

I see this question here on SO but I am not sure that answers my question. My Central SQL server is 2005 Standard. I am developing an app that requires SQL Express to be installed locally. I am then programmatically creating the Subscriptions and then Syncing them. Can I use 2008 Express for this on the local machines? ...

How can I remove leading and trailing quotes in SQL Server?

I have a table in a SQL Server database with an NTEXT column. This column may contain data that is enclosed with double quotes. When I query for this column, I want to remove these leading and trailing quotes. For example: "this is a test message" should become this is a test message I know of the LTRIM and RTRIM functions but th...

SQL - joining on multiple columns in the same row

Our school's ERP has a nasty database structure to it and since it is not normalized correctly, I have an issue with joining on the same table multiple times. The DegreeHistory table has these columns in one row entry for a person: |Major1|Major2|Major3|Minor1|Minor2|Minor3| -------|------|------|------|------|------| CMPT ...

How do I pass parameter TO SSRS report FROM ASP.NET page which has the reportviewer for the report.

I have an ASP.NET page which has report viewer control to access reports from report manager. I need to pass report parameter from this ASP.NET page to the report server. I want to pass region number based on user logged in, which is displayed on a label in ASP.NET page. Thanks. ...

SSRS not working from remote locations

I have couple of reports that i developed and are sitting on http//localhost/reports. I have everything else setup including sql server 2005 config tools. The reports run fine when i run them on my own machine, where IIS and sql server 2005 are both loaded. But they dont work when i try from other computers. I have the dir security to wi...

Handheld Development, Lazarus or Turbo Delphi.Net

I begin to program some handheld program as hobby, right now i currently have knowledge on Blackberry App (Java), Symbian S60 (PyS60) and J2ME Something that i wanna learn was Windows Mobile/Pocket PC and iPhone development, but since i don't use Mac so i step to Windows Mobile/Pocket PC development Here some question: 1. Which is bett...

How to select records from db according to date range?

I have a "LOGTS" columns with datetime data type in a table, i would like to select my records which is within the range of "Last Week", "2 Weeks Ago" and etc! How do i do this? ...

LINQ to SQL entity column name attribute ignored with guid primary key

I was working with a simple entity class with LINQ to SQL (SQL Server 2005 SP3 x64). [Table( Name="TBL_REGISTRATION" )] public sealed class Registration : IDataErrorInfo { [Column( Name = "TBL_REGISTRATION_PK", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert )] public Guid RegistrationID { get; private s...

Remote SP Call via Linked Servers. Asynchronous or not?

Hello Experts I have set up 2 servers which are linked. From my LOCAL SERVER, I am executing a SP that will be run on the REMOTE SERVER. The next part of the script requires me to INSERT DATA from the changes made via the SP on the REMOTE SERVER to the LOCAL SERVER. Therefore my question is, is this process asynchronous or synchronou...

[SQL] Update with two tables?

I am trying to update table A with data from table B. I thought I could do something like: UPDATE A SET A.name = B.name WHERE A.id = B.id but alas, this does not work. Anyone have an idea of how I can do this? ...

How to store multiple versions of DB data for auditing/merging?

I'm using ASP.net MVC and SQL Server, but I don't think the answer will depend on this architecture, and I'm equally interested in solutions that use other architectures. So... I have an object (row) within SQL that needs to be: versioned, updated by multiple people, approved, and merged. OPTION A) For a quick-and-dirty solution, I'm d...

Do connection string DNS lookups get cached?

Suppose the following: I have a database set up on database.mywebsite.com, which resolves to IP 111.111.1.1, running from a local DNS server on our network. I have countless ASP, ASP.NET and WinForms applications that use a connection string utilising database.mywebsite.com as the server name, all running from the internal network. Th...

Compressing Data Within a Query

Hello All, Suppose you have two linked servers called Local and Remote respectively. Is there a syntax that compresses (and uncompresses) the data required to be sent from the Local to Remote (or vice versa). For example, if I am updating my Local database with data from my Remote database, I would do the following: INSERT INTO [Loca...

SQL Server Source Control

When we first started source control the developers would just edit the scripts in the database and right before the release one big script of all the changes would be made. This worked great until one of the devs accidently deleted a stored procedure and all the work was lost. After that we put all the scripts to create the stored pro...

Remove SQL comments

Hi, our stored procedures have developer comments and headers and as part of our deployment process we would like to remove these from the customer copy. Is there a method of achieving this within SQL Server 2005 or with another tool? ...

Are these cross joins causing me problems?

I have a poor man's replication setup that I can't do anything about. Some identifying data (basically primary key) from a call_table is copied into another table via a simple trigger, and then the "replication server" runs a stored procedure to copy the data from the queue table to a #temp table (to prevent locking in SQL 6.5 is the cas...

Sql 2005 Table to Table merge with some data transformation

So a site I work on is migrating to a new data feed. The current data feed is fed over from an FTP site and presented to me in a two denomlized files. This is then pushed into two tables into a MS SQL 2005 server which the site then uses to run all the searches and such for (real estate site). The problem is, the new data feed is normil...

What indenting style do you use in SQL Server stored procedures?

None of my SQL Server stored procedure editing IDEs seem to have any tools to enforce indentation styles, so I find that a lot of the stored procedures I see are all over the place. I find indenting really improves readability though. I would like to codify some stored procedure indenting standards in our company's coding style guide, ...