sql-server

How to let SQL Server know not to use Cache in Queries?

Hello all, Just a general question: Is there a query/command I can pass to SQL Server not to use cache when executing a particularly query? I am looking for a query/command that I can set rather than a configuration setting. Is there no need to do this? ...

SQL Server Replication, Consolidation

How do I consolidate multiple publications into 1 consolidated table on the subscriber? For example. Consider a very simple sales model where we replicate sales data from the stores to the central office. Store 1 Sales Table ===================== Item Qty Amt ===================== 111 2 10.00 222 1 ...

How do I get a Date from SQL Server in Crystal Reports 11?

I have a stored procedure that selects from a table, two of the fields are DATE type in SQL Server, but when I select the stored procedure from Crystal Reports, the two date fields appear as Strings (in the YYYY-MM-DD format). I could write formulas to convert these to the MM/DD/YYYY output that is expected for this report, but is there...

How can I JOIN the query below?

SELECT PB_BANK_CODE, ---- DB ITEM PB_BANK_NAME, ---- DB ITEM TOTAL_AMOUNT --- NON DB ITEM FROM GLAS_PDC_BANKS where PB_COMP_CODE=:parameter.COMP_CODE AND pb_bank_code in(select distinct pc_bank_from from glas_pdc_cheques where PC_COMP_CODE=:parameter.COMP_CODE AND pc_due_dateTIME between :block01.date_from and :block01....

combine date and time column problem

Using SQL Server 2005 Date Time 20060701 090000 20060702 020000 20060703 180000 ... Date and Time datatype is varchar Tried Query select Convert(datetime, Convert(char(10), date, 103) + ' ' + Convert(char(8), time, 108), 103) from table SELECT CAST( DATEADD(dd, 0, DATEDIFF(dd, 0, date)) + ' ' + DATEADD(Day, -DATEDIF...

How to get only numeric column values?

Using SQL Server 2005 I want to get only numeric values from the table Column1 12345 asdf 2312 ase acd ..., Tried Query Select Isnumeric(column1) from table Showing Result as 1 0 1 0 0 .., I need the colum1 numeric value Need SQL Server Query help ...

Stored procedure..

I'm using If Condition Srore procedure... But .. I need if stored procedure with where in if else condition and concatenate with to and condition in Query.. Examble create procedure [dbo].[Sp_Name] @code int, @dCode int As select <.........> from <tablename> Where empcode=@code if (@dCode != 0) Begin And dptcode=@ dCod...

Regarding case when in stored procedure

hi guys, I have following query. declare @Prm_CourseId int declare @Prm_SpecializationId int set @Prm_CourseId=5 set @Prm_SpecializationId=0 declare @WhrStr varchar(500) set @WhrStr = case @Prm_CourseId when 0 then 'e.CourseId is null or e.CourseId is not null' when -1 then 'e.CourseId is null o...

SQL Server distributed databases

how to link two different database in same SQL Server instance and send queries between them ...

tempdb SQL Server locking

Hello! Our application runs alongside another application on a customers machine. We have put some efforts regarding avoiding long-running locks in tempdb since this obviously affects concurrency badly. The other application, however does things like: begin transaction create #Table(...); insert into #Table(....) values(...

Extremely Slow Performing SELECT

I have a table with with 7,526,511 records with the following definition: /****** Object: Table [dbo].[LogSearches] Script Date: 12/07/2009 09:23:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[LogSearches]( [ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL, [Acct_ID] [int...

SSIS Exec T-Sql Statement Task connection string

I dragged Execute t-sql statement task from toolbox. clicked new and created new connection. when i executed, it executed successfully. there was no db showing in con string. i changed the connection string to point to new server of above in Connection tab. when i executed it, i recv errr Description: Executing the query "DBCC SHRINKFI...

What would be a reliable way to get fractional value from a number?

I have a number of type Decimal(8, 2) and have been using Substring to get fractional value. E.g.) declare @val decimal(8, 2), @strVal varchar(10) set @val = 15.80 set @strVal = cast(@val as varchar) select @val, substring(@strVal, charindex('.', @strVal), len(@strVal)) Is there a better way to simply get fractional value, .80 fro...

Documentation Tempate for SSAS Cube

I need a template to document an SSAS cube. Cube info Single source of data One main Fact table Five direct dimensions Two many-to-many dimensions 48 Partitions, 48 Aggregations Can anyone point me to design templates for SSAS cubes? ...

Is there a way to parse a Google search string to a table variable in T-SQL?

Is there a way to parse a Google search string to a table variable in T-SQL? By Google search string I mean, including the plus sign (require), minus sign (exclude), and exact phrase (double quotes) operators. For example the following search string: one -two +three "four five" -"six seven" +"eight nine" "ten eleven twelve" Would be ...

Analysis Services Real Time Trace Logs

I'm looking to get the trace logs for AS (same stuff as for SQL server) in real time. I can't find any .net interfaces to this stuff. So far the only realistic solution I can think of is to run it permanently and have it dump to a new table which I listen to on updates via triggers. Does anyone know of a better way of doing this? This ...

SQL Server Comparing Subsequent Rows for Duplicates

Hi, I am trying to write a SQL Server query but have had no luck and was wondering if anyone may have any ideas on how to achieve my query. What i'm trying to do: I have a table with several columns naming the ones that i am dealing with TaskID, StatusCode, Timestamp. Now this table just holds tasks for one of our systems that run ...

FTS: Searching across multiple fields 'intelligently'

Hi, I have a SP using FTS (Full Text Search). I want searches across multiple fields, 'intelligently' ranking results based on the weights I assign. Consider a search on a view fetching data from tables: Book, Author and Genre. Now, I want the searcher to be able to do: "Ludlum Fiction", "Robert Ludlum Bourne", "Bourne Ludlum", etc....

Horizontal repeating list in SSRS

How can I make a list of values repeating horizontally in SSRS 2008? I tried to use the steps outlined at http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx but these steps are not congruent with SSRS 2008 and seem to be limited to SSRS 2000/2005. ...

Why is a trailing SET inconsistently throwing an error in SQL?

I'm looking at an error from one of our web applications, and it was calling a stored procedure that was responsible for updating a record in the database. This stored procedure has worked for weeks with no issues. Then one day it started throwing errors, while debugging we found the cause to be inside the stored procedure. It basicall...