What option need to use if cursor performance is overhead?
Hi,I have used CURSOR for one of my client need, it executed successfully however it perform slowly due to lot of operation perofrmed within cursor.I have used lot of INSERT's perofrmed within...
View Articlepivot sum
Hi,I'm trying to aggregate the values which are pivoted by this query, so that column 2 is the sum of column1 + column2, and column 3 is the sum of column1 + colum2 + column3. I want to add yesterday,...
View ArticleOne row per record query
Hi allI have a query which was returning duplicate rows. This is because one of the tables it's referring to has duplicates in it. I would like to limit the query to only return one row per record....
View ArticleHow to Scan a large table and insert Rows
I have got a large table with thousands of rows, but the basic pattern...
View ArticleHow do I Join Calendar table with other tables with sparse dates
Hi,I 'd need an insight on how to join Calendar table (contains all 2013-14 dates, granularity - day) with 3 other tables with sparse dates but with same granularity - day.Other 3 tables has similar...
View ArticleConvert IDs to Values
Hi Guys, I have got 2 tables: User Table UserID Email PublicationIDs -------------------------- 1 HR@test.com 11254|11255|11256| 2 Accts@test.com 11254|11256| 3 IT@test.com...
View Articlehow to manipulate data in a table
This is again out of my depth, therefore I need SQL Guru to help me again, Thanks guys in advance.This is a fraction of a large client table with thousands of rows. ClientStart DateEnd...
View ArticleSoundex
Hi, How can I use soundex function to compare two address fields similarity? or Is there any other function that I can use to compare any address? Thanks.
View ArticleBCP Command using SQL: destination location is another computer in the network
Hi, I am using BCP Utility to fetch the data from my sql table and dump in text file. I can able to dump the query result to text file in the system where sql server is installed and running. But,...
View ArticleOptimization sql query
hi, I have problem with execution time for below query. It is 4/5seconds. I can accept time below 1s. I use this query for search engine in online shop. I think there is problem with indexes. Many...
View ArticleInserting into another table based on filtered parameters
I have two tables of the same type, I want to run an insert into statement to table 2 that will only Insert data that are not already in table 2 based on column 1 and column 2. That is it will insert...
View ArticleAuditing an incident table based on select
Hi,Sorry I am new to SQL server and auditing. I have been asked to create an audit table which captures any Reads against an incident table by all users.I was wondering if anyone knows a way to...
View ArticleLog user access to file table
Hi Forum,I am trying to log access and changes to files in a FILESTREAM share. Mostly I want to log who changed a file and when.Can someone point me in the right direction?(I tried Google and serached...
View ArticleSQL query to group and create custom column
Hi,I use SQL server Management studio,In Table1 we have Name and Dept column, if the person is in more than one dept then assign then as result shown below.Is this possible to do it using case...
View ArticleUsing CASE with other Views
HiI am trying to create a case based on 2 different views called dbo.MostRecentStockWIPRecord and dbo.MaxJVD working with null values. Here is the code I have created: SELECT mrswip.PalletID,...
View Articlecan FORCED parameterization can help on reporting databases,
Hi, The situation is, i have 1000 queries getting executed (sent) from web application and 400 sp in Database.they used to show data from reporting database, it is only used for reporting.some of...
View Articlejoin two diff tables
hiIn the below query the Name is in Table2 and Dept is in Table1, in such case how to alert the below queryin table1 Name = table2 empnameSELECT m1.Name, ( SELECT left(m2.Dept,1)+ '/'...
View ArticleHow to parse connection strings on a column in SQL Server 2008
I want to extract database names from a varchar column storing connection strings. A sample value is; 'server=SVR1;database=DB1;uid=user1;pwd=pass1;enlist=true;' Each record might have a slightly...
View ArticleCan you help me write this SQL query.
This query works:- Select col_ID,col_Name as Name from TableName But; I want the part after AS (coloumn name) dynamic:- Select col_ID,col_Name as (Select tl_name from Table2 where...
View Articlewhich isolation level is good for reporting datbases where only reading goes no.
hi,Please tel me on reporting database where only reading is going on which isolation level is good1) Read commited Row Versioning 2) snapshotyours sincerely
View Article