extract parameter names and values from a string
Hi - We have a stored procedure log that records the parameters and values for each stored procedure that is executed. In an effort to make a particular stored procedure run more efficiently, it would...
View ArticleUsing UPDATE with MERGE When Data Hasn't Changed
In my MERGE statement, my source and target are mapped on the BenefitLookupGroup1Key (see query below). If that value matches between the source and target tables, an UPDATE between the two tables...
View ArticleSql Dependent Queries Not Automatically Recompiled
Hi there,I am a simple guy, wondering what is going wrong:I make 2 TVF's the second depending on the first. If I alter the first, the second one still used the old version of the first TVF. It seems...
View ArticleInconsistent performance of a script
Have you ever written a complex script and 99 times out of 100 it does EXACTLY what it is supposed to do? Then on that 100th run it does something unexpected? Like a record that should have gotten...
View ArticleAlt+F1 , SP_HELP
Hi Friends, i have alter some column length of Tables, now i am checking the same table by hitting Alt+F1, it is still showing old valuesEG Fname Varchar(50), is updated to Fname Varchar(100), but if i...
View ArticleOpenQuery Where Clause Error!!!
I have 2 openquery statements that I'd like to filter without doing a subquery. How can I do this? the Where Clause is giving me trouble.--I want to join these 2 statements and filter by the where...
View ArticleSimple way of changing from rows to columns?
I would like to use this result with an ssrs chart, but apparently, it would be easier for the chart to 'display' this if it were column-wise instead of rows.Is there a relatively easy way of...
View ArticleQuery help needed
Hi I have a requirement and I am not sure how to go about it.I have a Shipment queryDatatypesticketnum varchar(10),POnum int,Ext_Price float,qty int,shipping Int,sale_price Intselect...
View ArticleAverage for the last ten days repeated row by row
Hy everyone, I got a problem, I have this table[BERLIN]([QUA] [date],[COST] [decimal](18, 2) ,[REVEN] [decimal](18, 2),[COSA] [nvarchar](50) I'm doing a lot of average, sum and count but now I'm locked...
View ArticleNeed help with Subqueries in FROM clause
Hi, I'm novice with SQL and this is my first post on the forum. I hope to learn quickly to help those who need my time. My question relates to the following tables:COMMENTS...
View ArticleWhy SQL_Hungarian_CP1250_CI_AS is case sensitive ?
Hi,I have the following databaase :CREATE DATABASE Hungarian COLLATE SQL_Hungarian_CP1250_CI_AS USE Hungarian CREATE TABLE [dbo].[tbl]([id] [int] IDENTITY(1,1) NOT NULL,[my_nvarchar]...
View ArticleINDEX of column(s) in ORDER BY with OFFSET and FETCH
I am using SQL Server 2012 to try to implement efficient paging using OFFSET and FETCH. Here's some sample code:SELECT ID, Name, ... , ColumnZ FROM SomeTable ORDER BY Name DESC OFFSET @StartRowIndex...
View ArticleCan you set a single FILEGROUP to READONLY without getting exclusive access...
I'm in the process of building a partitioned table with a sliding-window partition. I have several years of historical static image data that will be moved to individual filegroups created to hold...
View ArticleQuick SQL Sintax Help
So for reason I would rather not discuss I have to modify a really old asp page... They need it to add some simple data to a table in a SQL Server 2008 database...So far everything is going great but...
View ArticleCounts by Time Interval
Using SQL 2008 R2 + SP 2 x64 on Windows Server 2008 R2 x64.I have a program that processes data from 10 PM to 8 AM each day. I want to get a count of how many processed in each hour.The output should...
View ArticleHow to compare with Audit Table - Microsoft SQL Server 2000 - 8.00.2055
Hi, Here are two sample Tables. PLEASE NOTE: THESE ARE JUST SAMPLE TABLES CREATED TO SIMPLIFY THE QUESTION. I DID NOT ADD ANY EXTRA THINGS, NO PRIMARY KEY OR ANYTHING. THESE ARE JUST TO WORK WITH...
View ArticleOptimization?? Too slow! Like Molassis!!!!
How can I optimize this?SELECT *FROMOPENQUERY(ORDERINFO,'Select * From globalCommerce.dbo.tblGlobalOrderItems with (NoLock)')WHEREGlobalOrderID...
View ArticleSql statement with Case not working
I'm not sure why this is not working. It worked fine until I put in the second Case SELECT OrderInfo.SerialNumber,customerid,case CustomerID when 'S325' then (Select b.region) else (Select CustomerId)...
View ArticleSQL Formatting Tool
Guys,Is there any good tool available to format the SQL Code. I have bunch of stored procedures and I want to do proper alignment and formatting of the code. I was wondering if there is any free tool...
View ArticleAppending text to a field that already contains text using TSQL
I want to append some text into a field that already contains text without overwriting what is already there. I want to do this using TSQL. Any help on how to do this would be appreciated.Thanks
View Article