sql-server

how to parse an xml string in mysql?

in ms sql I have the following code: ALTER PROCEDURE [dbo].[xmlDictamen_Alta] @Xml text as begin declare @Id integer declare @DocumentoId numeric(18,0) declare @Descripcion varchar(300) begin set nocount on exec dbo.sp_xml_preparedocument @Id output, @Xml select @DocumentId = DocumentId, ...

how to parse an xml string in postgres

in ms sql I have the following code: ALTER PROCEDURE [dbo].[xmlDictamen_Alta] @Xml text as begin declare @Id integer declare @DictamenId numeric(18,0) declare @DocumentoId numeric(18,0) declare @Descripcion varchar(300) begin set nocount on exec dbo.sp_xml_preparedocument @Id output, @Xml select ...

Unexpected error about DateTime type

Hi everyone, I have a .aspx page for adding new product include the following field: ID, Name, DateTime, Price and it run well at localhost but when I publish it and up to the server, then I get the following error: System.Data.UpdateException: An error occurred while updating the entries. See the InnerException for details. ---> Sy...

How to make Column to Row without an aggregate funtion in sql server 2005/8?

For example, I need to change from to . I know PIVOT is for that, but it requires an aggregate function; and for my case, I donot need to aggregate only need column to row. You can use the following sample data: CREATE TABLE[StudentScores] ( [UserName] NVARCHAR(20), [Subject] NVARCHAR(30), [Score]FLOAT, ) GO INSERT INT...

What issues to anticipate having different collations between development and production SQL Servers?

Subquestioning "Unable to update sys.columns - any other approach?" vaguely mentioning the problems on deployment to server with a different collation. The problem is that by default SQL Server collation is determined (during setup) by Windows Regional and Language Options --> Advanced --> "Select a language to match the language vers...

how to create one to one relationship sql server diagaram

Hi, does anyone know how to create one to one relationship sql server diagaram? thanks ...

What is the usage of policy management in sql server 2008?

What is the usage of policy management in management part of sql server 2008?? ...

Where are all those SQL Server sessions from?

After launching SSMS (2008 R2) on my dev machine, which I launch with "D:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" -nosplash -S localhost -d testdata without doing anything, in Activity Monitor I observe some sessions (TestData is my default database) Details of session 51: select @@...

Using cast or convert to convert negative int values to datetime in SQL Server

I have some negative integer values which are an offset from the default 1-1-1900 date. I have to get the datetime values from these. How can I do this. Example: If I do: SELECT convert(datetime, 53691) as Calc OR SELECT cast(53691 as datetime) I get: 2047-01-01 00:00:00.000 What I need is that If I do: SELECT convert(datetime, ...

Identity insert - performance

I have one solution where I insert rows where I use GUIDs instead of an Identity. The Guid is generated in c#. I have another solution where the table, indexes etc are identical, but instead of GUIDs I use identities and let Sql-server generate them. In the later case I get a performance issue.... Ideas? //Daniel EDIT I really am so...

Custom Logging within sql server 2008 Scheduler Job > View Histroy?

I am creating sql server 2008 Agent scheduler job form sql script. Want to Log the details if failed in some case within Job > View Histroy. Is there any way, so we can log custom text with Job > View Histroy? ...

No way to execute SQL script from SQL Server Query Manager like @{file.sql} oracle sqlplus syntax?

Like the title says, in oracle you can issue the following command in SQL*Plus: SQL> select something from anothertable; #sql SQL> @{/home/me/somescript.sql}; #load sql from file and execute it SQL> do something else in script; #other sql Without having to file->open the sql script to load it to the UI. Is there an equ...

Track changes on column X and update the value of column Y by Trigger in Sql Server

CREATE TRIGGER ChangesTracker on [SearchEngine].[Urls] FOR UPDATE, INSERT AS UPDATE [SearchEngine].[Urls] SET [IsNormalized] = 0 WHERE [AbsoluteUrl] NOT IN or <> or != (SELECT [AbsoluteUrl] FROM INSERTED) What's wrong? UPDATE Thanks @codeulike for your help. I put correct trigger t-sql to an answer. ...

Referencing external database in a View?

In a project on which I am performing maintenance, I am referencing a database stored on another server. This reference was previously pointing at a database on the same server, but my testbed server isn't large enough to store both databases, so I'm having to refer back to the live database. Anyway, whoever created this application mad...

%Rowtype equivalent in SQL Server

I'm about to convert a stored procedure from pl/sql to SQL Server. The procedure uses a cursor to loop through the results of a select query. Is there a SQL Server equivalent to the ORACLE rowtype construct? ...

SQL Server MDF file

Hello, I am working on a website that has access data from a database (sql server). It will also be adding, updating deleting records in the database. It seems like there is an MDF file that gets created containing the database schema and all the records I guess? Once development is complete and I want to move this database to a real se...

how to force a stored procedure be pre-cached and stay in memory?

Stored procedures are compiled on first use. There are options to clear cache: DBCC FREEPROCCACHE DBCC DROPCLEANBUFFERS --To Verify whether the cache is emptied --DBCC PROCCACHE or to recompile or to reduce recompilations. But is it possible to force frequently used stored procedures' execution plans be pre-cached and stay in...

How to enable only Standard Edition features in SQL Server 2005 Dev Edition?

I've got the following problem. We have Development, Testing and Production environments for our system. All these environments will contain SQL Server 2005, but different editions. The Production will work with Standard Edition. Now we would like to install Dev Edition on other servers (to save our money), but as far as I know, Dev Ed...

SQL Server Full Text Search Results differs from Like statement

Hi everybody I tried these two methods on Advantureworks and got different results. select * from Person.[Address] where AddressLine1 like '%99%' select * from Person.[Address] where contains(Address.AddressLine1,'"*99*"') Any Idea? ...

Why is there is a difference between equality comparison between equal operator and like operator ?

SELECT au_lname, au_fname FROM authors WHERE au_lname = 'Green ' au_lname au_fname ---------------------------------------- -------------------- Green Marjorie SELECT au_lname, au_fname FROM authors WHERE au_lname LIKE 'Green ' au_lname ...