I have a MS SQL Query that is pulling data via from a remote server. The data that I'm pulling down needs to be filtered by a date that is determined at run time.. When I run the query like this:
SELECT * FROM SERVER.Database.dbo.RemoteView
WHERE EntryDate > '1/1/2009'
then the filter is applied remotely... However, I don't actua...
There is a view in my DB that someone defined with a * from one table. I just added a new column to that table and I want the view to reflect the new column. Besides re-executing the view creation script, is there another way to rebuild the view? I am looking for something similar to how sp_recompile will recompile a stored procedure ...
Environment: SQL-Server-2005, SSAS 2005
I am using the following formula to create a Moving Annual Total
SUM ({[Time].CurrentMember.Lag(3):[Time].CurrentMember}, [Measures].[TRx Quantity])
The same column [Measures].[Trx Quantity] is used in other calculations and it works fine. This one, however, comes up with #Value! to indicate so...
Last night I was writing a simple T-SQL program something like this
DECLARE @ROLEID AS INT
SELECT @ROLEID = [ROLE ID] FROM TBLROLE
;WITH CTE
AS
(
SELECT * FROM SOMETABLE
)
IF (@ROLEID = 1)
BEGIN
//SOMECODE
END
ELSE IF(@ROLEID = 2)
BEGIN
//SOMECODE
END
ELSE
BEGIN
//SOMECODE
END
I found after compilation th...
Hi,
We have a utility written in C which reads columns extracted from a database using a stored procedure and outputs a csv file. Simple huh. However when reading a smallint column, it crashes out and not being the greatest C programmer on the planet, I can't nail it. As a workaround can you change the data type in a stored procedure e....
Hi all
I have a program which would use the Application Role to write data to a SQL Server 2005.
using (SqlConnection sqlCon = new SqlConnection(connectionString))
{
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlCon;
sqlCommand.CommandTyp...
I have a table in SQL Server 2008 with a column having the string stored in JavaScript Escape format. When queried from application, I am doing the JavaScript UnEscape of the returned string, so no issues.
How do i UnEscape the string when I directly query the database? Is there any equivalent function for JavaScript UnEscape in SQL?
...
SELECT
PC_COMP_CODE,
'R',
PC_RESUB_REF,
DECODE(PC_SL_LDGR_CODE,'02','DR','CR'),
PC_DEPT_NO DEPT,
'',--PC_DEPT_NO,
PC_SL_LDGR_CODE+'/'+PC_SL_ACNO,
SUM( DECODE(PC_SL_LDGR_CODE,'02',1,-1) *PC_AMOUNT),
PC_CHEQUE_NO CHQNO
FROM GLAS_PDC_CHEQUES
WHERE PC_RESUB_REF IS NOT NULL AND PC_DISCD NOT IN ('d','D','T')
GROUP BY PC_RES...
I have imported an existing SQL Server 2008 database to a Visual Studio 2008 database project, to version control database objects and perform database code migration. This works fine and I can build and deploy to dev, test, staging, live etc.
Now I want to add a new stored procedure (with a grant statement) to the existing database pro...
I'm looking for an elegant way to convert a field of type varchar, with variable data in it, to a data type which can be used for mathematical operations sample data from the field
(excluding quotes)
''
'abc'
'23'
'23.2'
The method should work for all, and for the first & second values should return 0, and not throw an SQL Server err...
Hello,
Dear professionals please help me with the following problem.
In my .NET C# application a have this code:
SqlConnection connection = new SqlConnection( SQLCONNECTION_STRING );
It works marvelous on my development machine but throws an exception on Windows 2003 server. The application runs through CGI and has “Full trust” level....
Using SQL 2005: “Taking too much time to execute”
I want to filter the date, the date should not display in holidays, and I am using three tables with Inner Join
When I run the below query, It taking too much time to execute, because I filter the cardeventdate with three table.
Query
SELECT
PERSONID, CardEventDate tmp_cardevent3 ...
I am using tomcat 6.0 and running Solr in it. Can some one help me how to configure solr to index SQL Server DB?
...
Hello everybody!
We are writing this paper about database access in a web app and have to distinguish between the different categories of the database access layer.
All books and PDF's given us provide only information to JDBC or OLEDB.
Researching on the web brought me to the point that access to a Microsoft SQL Server trough linq-to...
Hello all,
I am trying to make use of the PHP driver for MS SQL Server version 1.0.
I have everything setup but I think I am having trouble loading up the extension php_sqlsrv_ts.dll. I have gone to the command line and try this:
C:\wamp\bin\php\php5.3.0>php.exe --re sqlsrv
Exception: Extension sqlsrv does not exist
C:\wamp\bin\php\p...
I'm trying to compute a checksum or a hash for an entire table in SQL Server 2008. The problem I'm running into is that the table contains an XML column datatype, which cannot be used by checksum and has to be converted to nvarchar first. So I need to break it down into two problems:
calculate a checksum for a row, schema is unknown be...
I was told that there is new a feature in SQL Server 2005 called index filters.
What I want to do is add an Index to a column and have the index ignore null values.
I can't find good information on this feature (maybe my source is wrong). Can anyone provide additional information on this feature?
...
Using SQL Server 2005
Table1
ID FromDate ToDate
001 23-02-2009 25-02-2009
001 27-02-2009 29-02-2009
002 12-02-2009, 25-03-2009
...,
Table2
ID Name Total
001 Raja 30
002 Ravi 22
I want to get total day for the personid
Tried Query,
SELECT
table2.Id, table2.name, table2.total,
datediff(day, table1.fromdate, table2.toda...
Here's my scenario: I have two tables A, B which (for the sake of this question are identical):
Table X (PK)
ID
1
2
Table A:
ID FKID Value Sort
1 1 a 1
2 1 aa 2
3 1 aaa 3
4 2 aaaa 1
5 2 aaaaa 2
Table B:
ID FKID Value Sort
1 1 b 1
2 1 bb 2
3 2 bbb 1
4 2 bbbb 2
5 2 bbbbb ...
I'm writting a setup program that needs to install the DataMining Adding for Office 2007.
1) How do I detect if it's already installed?
2) If it is not installed, I download and run the MSI (SQLServer2008_DMAddin.msi). But how can I run the Server Configuration (Microsoft.SqlServer.DataMining.Office.ServerConfiguration.exe) tool myself...