Is there a way to get the profiler without installing Microsoft Sql Server?
If the answer is no, which edition do I need to get the profiler? Do I need the Developer Edition?
I would like to do something like this i.e., use wild card characters in the in clause:
SELECT * FROM mytable WHERE keywords IN ('%test%', '%testing%')
This is not supported in MS SQL.... Is there some other way to achieve it...
Looking for something other than:
SELECT * FROM mytable WHERE keywords like '%test%' or keywords like '%testing%' or.....
I have an Oracle SQL query as part of a stored proc:
DELETE FROM item i WHERE NOT EXISTS (SELECT 1 FROM item_queue q WHERE q.n=i.n) AND NOT EXISTS (SELECT 1 FROM tool_queue t WHERE t.n=i.n);
A bit about the tables:
item contains about 10k rows with an index on the n column
item_queue contains about 1mil rows also with index on n column
tool_queue contains about 5mil rows indexed as well
I am wondering if the query/subqueries can be optimized somehow to make them run faster, I thought that deletes were generally fairly fast
i am doing this:
CREATE TABLE person
(
num INT NOT NULL ,
firstname VARCHAR(20) NULL ,
lastname VARCHAR(30) NULL
);
sql server is just saying "debbuging" and it's not doing anything
is there a problem with the syntax or what?
I have a table for animals like
Lion
Tiger
Elephant
Jaguar
List item
Cheetah
Puma
Rhino
I want to insert new animals in this table and I am t reading the animal names from a CSV file.
Suppose I got following names in the file
Lion,Tiger,Jaguar
as these animals are already in "Animals" table, What should be a single SQL query that will determine if the animals are already exist in the table.
I use SQL Server 2000.
Suppose I have two tables like the following:
Area
----------------------------------
ID| Name | HierarchyLevel
----------------------------------
1 | World | 1
2 | America| 2
3 | Europe | 2
4 | Africa | 2
5 | USA | 3
and
AreaHierarchy
------------------------
ID | ParentID | ChildID
------------------------
1 | 1 | 2
2 | 1 | 3
3 | 1 | 4
4 | 2 | 5
where
AreaHierarchy.ParentID and AreaHierarchy.ChildID are FKs of Area.ID
How can I find the nth parent of USA?
Is it possible without looping?
Probably not.
I am getting the error from the application as following with SQL server 2005
"Transaction count after EXECUTE
indicates that a COMMIT or ROLLBACK
TRANSACTION statement is missing.
Previous count = 1, current count =
0"
How can i find the stage where this error raised?
how can i found the missing transaction or the stored procedure where it is not committ or rollback?
I am trying to insert NULL value in Sql Server if I have null value in corresponding C# String object like below :
String Residence = xmlDoc.Descendants("Appointment").Single().Element("StateOfResidence") == null ? null : xmlDoc.Descendants("Appointment").Elements("StateOfResidence").Single().Value;
I am using Entity framework for Database access. So if Residence is null, 'NULL' gets inserted into Database instead of NULL. How can insert NULL for null ?
For example, imagine that I want to see if a user exists in my database:
Select * from Users where inputID = Users.ID
Then if that result brought 0 items, then the user exists, correct?
How can I do something like this using a pure Linq-to-SQL class?
In PostgreSQL there is the Limit and Offset keywords which will allow very easy pagination of result sets. What is the equivalent syntax for Sql Server?
I have a SQL Server 2012 Sequence object:
/****** Create Sequence Object ******/
CREATE SEQUENCE TestSeq
START WITH 1
INCREMENT BY 1;
I have a SP that runs some queries inside a transaction:
BEGIN TRAN
SELECT NEXT VALUE FOR dbo.TestSeq
<here all the query update code......>
ROLLBACK TRAN
If the transaction fails all the updates are rolledback without problem but the Sequence is not rolled back I guess because Its out of the scope of the transaction.
Any clue on way to handle that?
Thanks
I am trying to write a sql query like the example below, however, I need it to always choose the DateEntered field between the current day's date at 8:00am and the current day's date at 4:00pm. Not sure how to go about this. Can someone please help?
SELECT OrderNumber
, OrderRelease
, HeatNumber
, HeatSuffix
, Operation
, COUNT(Operation) AS [Pieces Out of Tolerance]
FROM Alerts
WHERE (Mill = 3)
AND (DateEntered BETWEEN GetDate '08:00' AND GetDate '16:00')
GROUP BY OrderNumber, OrderRelease, HeatNumber, HeatSuffix, Operation
Hello Guys!
I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories.
Category
Id : bigint (PK)
Name : nvarchar(255)
AcceptQuestions : bit
IdParent : bigint (FK)
Question
Id : bigint (PK)
Title : nvarchar(255)
...
IdCategory : bigint (FK)
How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(
Suppose I have got a table which I have to insert the description of the contract under different keys of contract.
But when executing, there is a n error near then
Is there any limitation of using syntax set ?
The below is my SQL
declare @i int, @j v nvarchar(MAX)
set @i = 1
while (@i<=8)
begin
set @j = case when @i = 1 then 'CR' when @i = 2 then 'Facebook' else 'N/A' end
INSERT INTO CostNature (CNKey, CNNDescription) VALUES (@i , @j );
set @i = @i + 1
end
I've got a column in a SQL Server table that is type XML. I want to change multiple values in the XML in a stored proc. I've already found the XML.Modify(...) command and have it working for a single value. Can I change multiple values in the XML in one update command or do I need to do it as multuple update commands?
With windows and sql server accounts, I can access the logged in user with functions like: user_name() or suser_sname().
Can I access the user that is logged into asp.net in the same way?
i am using sql server 2005, please tell me how can i get 6 digits (unique numeric which should be random) value for every row in table.
i have a field in table in which i needs 6 digit numeric value (random and unique).
please help me to do this.
Is it possible to create a table which has a check constraint on one of the column whose value lies within the result set given by another sql query
eg.
create table tablename
(
name varchar(10),
rollno int
)check rollno in (select rollno from anotherDatabase.TableName,candidateRoll)
or any thing like that.
I dont have to use it anywhere but still want to know.
In VS2005, I am using a DLL which accesses a SQL Server. The DLL returns a SQLException
Invalid object name 'tableXYZ'
but tableXYZ is a table in the database.
Should it be looking for dbo.tableXYZ instead? Is this a permissions issue with the login being used?
Hi,
I'm using Sql Server 2005 and i'm trying to achieve something like:
In the same select statement i want to get the first x rows and the last x rows.
SELECT TOP(5) BOTTOM(5)
Of course 'bottom' does not exist so i need other solution.
I believe there is an easy and elegant solution that i'm not getting.
Doing the select again with Group By Desc is not an option.
Thanks.
I need to make DISTRIBUTED TRANSACTION between two MS SQL Server 2005,
it drops an error that NO ACTIVE TRANSACTION IS PRESENT or smth like this.
DTCTESTER programs drops an error that transaction could not be done.
btw 135 port is open on the firewall.
Maybe anyone knows what a problem, or have a suggestion?
i m using SQL Server 2008 R2.
i want to update my column CODE_DEST with increment number
CODE_DEST RS_NOM
null qsdf
null sdfqsdfqsdf
null qsdfqsdf
what i want:
CODE_DEST RS_NOM
1 qsdf
2 sdfqsdfqsdf
3 qsdfqsdf
i have try this:
update DESTINATAIRE_TEMP
set CODE_DEST = TheId FROM (SELECT Row_Number() OVER (ORDER BY [RS_NOM]) as TheId from DESTINATAIRE_TEMP)
not work because of )
and this
With DESTINATAIRE_TEMP As
(
SELECT
ROW_NUMBER() OVER (ORDER BY [RS_NOM] DESC) AS RN
FROM DESTINATAIRE_TEMP
)
UPDATE DESTINATAIRE_TEMP SET CODE_DEST=RN
because of union
im trying to work through some questions and im not sure how to do the following
Q:Find the hard drive sizes that are equal among two or more PCs.
its q15 on this site
http://www.sql-ex.ru/learn_exercises.php#answer_ref
The database scheme consists of four tables:
Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, screen, price)
Printer(code, model, color, type, price)
any pointers would be appreciated.
Hello Guys!
I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories.
Category
Id : bigint (PK)
Name : nvarchar(255)
AcceptQuestions : bit
IdParent : bigint (FK)
Question
Id : bigint (PK)
Title : nvarchar(255)
...
IdCategory : bigint (FK)
How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(
In SQL Server, it is possible to test the result of a stored procedure to know if the result return rows or nothing ?
Example :
EXEC _sp_MySp 1, 2, 3
IF @@ROWCOUNT = 0
BEGIN
PRINT('Empty')
END
ELSE
BEGIN
PRINT(@@ROWCOUNT)
END
But @@ROWCOUNT always return 0 so maybe is there another way of doing this ?