Hello, I am attempting to make an application capable of running on both Sql Server and PostgreSQL.
I can not seem to find a common expression that is basically
select * from table where booleancol=false
on SQL Server I must do(which is very confusing because the default value for bit types must be true or false, but you can't assi...
I designed 5 stored procedures which almost use same join condition but parameters or values in where clause change for each on different runs.
Is it best solution to create a view with all join conditions without where clause and then query from view or work on view? Can views auto update itself if i create view?
Can i do sub-queries o...
I would like to use SMO to generate a set of insert statements to copy data between environments. I have this working, but for some reason, datetime fields are formated as hex values that are casted to datetime. This makes the scripts hard to read and impossible to update. Is there a way for me to change this to use a string represent...
I'm looking at my event viewer on my computer and seeing that every single event in the Applicaiton event viewer is a Failure Audit for SQL Server. The properties of the event all say
Login failed for user 'sa'. Reason:
Password did not match that for the
login provided. [CLIENT:
78.111.98.132]
Does this mean that there is s...
Possible Duplicate:
Activity Monitor Problems in SQL Server 2005
I have some processes running on my database server that are taking up enourmous amount of CPU. When I view the detail about the process I get:
set transaction isolation level read committed
The other details include:
Status: Sleeping
Open Transactions: 0
Com...
Hi
I have a CTE as follows
WITH details
AS ( SELECT FldId
,Rev
,Words
,row_number() OVER ( PARTITION BY FldId ORDER BY Rev DESC ) AS rn
FROM WorkItemLongTexts
WHERE ID = 2855
)
SELECT f.ReferenceName
,d.FldId
,...
I want to drop all the SQL Agent Jobs which are not currently running and have description of 'xxxx'. How can this be done in script?
As of now i got this done as below and sure there would be better way to do.
DECLARE @job_owner_name VARCHAR(100)
DECLARE @MaxJobs INT
declare @RowCnt INT
DECLARE @jobId NVARCHAR(36)
select @RowCnt = 1
...
I have a query like the following:
SELECT t1.v3, t2.v2
FROM t1
INNER JOIN t2
ON t1.v1 = t2.v1
WHERE ISNULL(t1.DeleteFlag,'N') = 'N'
I have an index in place that I think should result in there being an Index Seek for the = 'N' part but instead I am seeing a very expensive Index Scan. Is it possible that the index is messing up the c...
Every SQL Server connection string I ever see looks something like this:
Data Source=MyLocalSqlServerInstance;Initial Catalog=My Nifty Database;
Integrated Security=SSPI;
Do I need the Initial Catalog setting? (Apparently not, since the app I'm working on appears to work without it.)
Well, then, what's it for?
...
I know there is a similar question: http://stackoverflow.com/questions/896985/connect-to-sql-server-2005-from-perl-and-do-a-select , but I tried the accepted answer and am unable to get it to work.
Assuming I have a db named test, and would love to do a select from mytable
(select id, name from mytable)
Code is from the link above wi...
I need to check if a content database for SharePoint has been restored (as some point in the past).
Are there any log file entries - in SharePoint or SQL Server - I can check for to determine this? Or any other approach (apart from asking someone)?
...
I'm using the Import/Export Wizard to import some data to a table. Total of 2 rows, so I've just been working around this, but I would like to know the answer.
The issue with the Import/Export is the dates. No matter what I do, they fail. The date looks pretty straightforward to me: 2009-12-05 11:40:00. I also tried: 2010-03-01 12:00 P...
In SQL it is possible to run inserts and updates against a view, as long as the view only selects data from one table. However, deletes don't seem to work quite so well. Can anyone help out?
Take this view for example:
CREATE VIEW v_MyUpdatableView
AS
SELECT x.* FROM MyPrimaryTable x
LEFT OUTER JOIN AnotherTable y ON y.MyPrimar...
I have a SQL Var @SumScore dec(9,4)
I am trying to assign the variable as follows:
SET @SumScore =
(
SELECT Sum(
(
SELECT SUM(etjs.CalculatedScore * sc.PercentOfTotal) as CategoryScore
FROM tblEventTurnJudgeScores etjs
INNER JOIN tblJudgingCriteria jc ON jc.JudgingCriteriaID = et...
How to know if all the cells have the same value in some column (title changed)
I want to have a bit scalar value that tells me if all the values in a column equal something:
DECLARE @bit bit
SELECT @bit = TRUEFORALL(Name IS NOT NULL) FROM Contact
UPDATE
I now realized that I actually don't need the TrueForAll, what I do need is to ...
If I want to select all records in a table that have not been processed yet and then update those records to reflect that they have been processed, I would do the following:
SELECT * FROM [dbo].[MyTable] WHERE [flag] IS NULL;
UPDATE [dbo].[MyTable] SET [flag] = 1 WHERE [flag] IS NULL;
How do I ensure that the UPDATE works on only th...
I am trying to determine a SCORE from 11 rows in a table.
Those 11 rows are being aggregated into five rows using a ScoringCategoryID column as follows...
ScoringCategoryID CategoryScore PercentOfTotal
---------------------------------------------------------
7 15.00 0.40
8 15.0...
I want to manage SQL Server dynamically, that is through code I wan to scan SQL Server for available databases than I want to create new database, access older database, alter it, and insert data into database depending upon table schema what is better approach what should I use?
i heard name of nhibernate, SQL Server Management Object ...
Hi,
I have 2 big tables in sql server that i need to sync to mysql.
now, i need that as an ongoing process.
the tables are 1 GB each and getting new/update/delete row every 0.1 second.
Can you recommend me a tool that can do it that is not resource expensive.
you can offer OPEN SOURCE and commercial as well
Thanks
...
Here is my query (from a trigger):
UPDATE QuoteItemsGroupFeature
SET Cost = (QuoteItemsGroup.BaseCost + QuoteItemsGroup.AccumulatedCost +
ISNULL(SUM(ParentQuoteItemsGroupFeature.Cost), 0)) * INSERTED.Amount
FROM QuoteItemsGroupFeature INNER JOIN INSERTED
ON QuoteItemsGroupFeature.QuoteItemsGroupFeatureId =
INSERTED.QuoteIt...