Using SQL Server 2005. I am building an inventory/purchasing program and I’m at the point where I need the user to “check out” equipment. When he selects a product, I need to query which stock locations have the available Qty, and tell the user which location to walk to/ retrieve product.
Here is a query for a particular [StockLocation_...
Why does
select avg(cast(5 as numeric(15,2)))
returns "Arithmetic overflow error converting numeric to data type numeric."?
Documentation states the following about the avg function:
input: decimal category (p, s)
output: decimal(38, s) divided by
decimal(10, 0)
I don't really see how it would overflow.
...
Hello Friends, I have some troubles trying to move data from SQL Server 2000 (SP4) to Oracle10g, so the link is ready and working, now my issue is how to move detailed data, my case is the following:
Table A is Master
Table B is Detail
Both relationed for work with the trigger (FOR INSERT)
So My query needs to query both for create a ...
Is there a way to do this shorter, for instance using some sort of conditional operator in Transact-sql?
IF @ParentBinaryAssetStructureId = -1
BEGIN
SET @ParentBinaryAssetStructureId = NULL
END
UPDATE BinaryAssets.BinaryAssetStructures
SET ParentBinaryAssetStructureId = @ParentBinaryAssetStructureId
WHERE BinaryAssetStructu...
Is there a .Net API or object model for using SQL Service Broker?
...
Thanks to the people who answered my question this morning:
http://stackoverflow.com/questions/2087664/sql-server-2008-count-number-of-keys-in-multiple-date-ranges
This is an extension of it and I'm not clear how to generalize the previous solutions to this case.
The database I'm working with has medications, lab values, and diagnoses...
I mean, something equivalent to Ctrl + K + D from Visual Studio that automatically indents code. Is there something in this sense?
...
So I saw this question/comment...
http://stackoverflow.com/questions/1625991/how-to-integrate-sql-server-2005-express-edition-to-visual-web-developer-2008-exp/1626114#1626114
And this is EXACTLY what I am having trouble with, only using SQL Server 2008 express edition and Visual Web Dev 2008 express. Everytime I try to click to add a ...
Say I have a table of items representing a tree-like structured data, and I would like to continuously tracing upward until I get to the top node, marked by a parent_id of NULL. What would my MS SQL CTE (common table expression) look like?
For example, if I were to get the path to get to the top from Bender, it would look like
Comedy
...
My query returns a query result which appears to be sorted, though there is no order by statement available. This could be coz of the clustered index.
Is it wise to depend upon index for sorting?
Is it a best practice to rely on index for sorting?
Thanks
...
Hey.
I am remotely accessing SQL Server Express 2008.
I have turned on service "SQL Server Browser"
I have turned on service "SQL Server (SQLExpress)"
I have enabled TCP/IP and set dynamic ports to blank and tcp port to 1433 in properties
I can connect localy(using ip) so my credentials are correct.
I have a exceptions record in my wi...
I need to present a flag - 0 if a condition is not meet, 1 if it is - and I can do it in two different ways :
Get Employee ID, name, 1 if has others in suborder - 0 if not :
SELECT e.ID
, e.Name
, ISNULL ( ( SELECT TOP 1 1 FROM Employee se WHERE se.ManagerID = e.ID ) , 0 ) AS HasSubordinates
FROM Employee e
or
SELECT ...
I have a simple query that runs in SQL 2008 and uses a custom CLR aggregate function, dbo.string_concat which aggregates a collection of strings.
I require the comments ordered sequentially hence the ORDER BY requirement.
The query I have has an awful TOP statement in it to allow ORDER BY to work for the aggregate function otherwise th...
I have two date fields with times.They are
1.2008-06-09 10:18:00.000
2.2008-06-10 11:20:00.000
I have to find the difference between the above two dates in the format -
"24 hour:2 minutes:0 seconds"
Is there any method to get this result in sql 2000?
...
Hai guys,
I ve used the following split function,
CREATE FUNCTION dbo.Splitfn(@String varchar(8000), @Delimiter char(1))
returns @temptable TABLE (items varchar(8000))
as
begin
declare @idx int
declare @slice varchar(8000)
select @idx = 1
if len(@String)<1 or @String is null retur...
I am new to SSIS and I am relying on a book, so this should be an easy question to answer.
I want to import data from all of the text files within a directory. So I create a Foreach container.
The first thing I want to do within the loop is execute a SQL task to drop and create the landing table.
Then I want to load the data into the ...
Dear GURUs
I would like to ask couple of questions regarding SQL Server Locking mechanism
If i am not using the lock hint with SQL Statement, SQL Server uses PAGELOCK hint by default. am I right??? If yes then why? may be its due to the factor of managing too many locks this is the only thing i took as drawback but please let me know ...
In my database MYDB i have a table called MYTABLE and inside it I have a column called NAME. I want to only return the first 100 characters of the column NAME. (NAME can be up to 2000 characters).
How can this be done in SQL as I want to set the first 100 characters to a ASP.NET label.
Thanks in advanced!
...
i have two tables and i want to select top row from child table?
there are relation by two tables by id.
what can i do please help me????
...
In my database MYDB I have a table called MYTABLE and I have a column called Description. I am saving a long description in there with multiple HTML tags.
How can i return the values and not include all the HTML tags?
Is this even possible? What will be the best way of doing this? In the SQL statement or in code behind? And how will I ...