Viewing 15 posts - 9,421 through 9,435 (of 10,144 total)
Something like this should do the trick:
[font="Courier New"]DROP TABLE #Order
CREATE TABLE #Order (Client VARCHAR(3), Product VARCHAR(3))
INSERT INTO #Order (Client, Product)
SELECT 'XXX','001' UNION ALL -- B
SELECT 'XXX','003' UNION ALL --...
November 17, 2008 at 9:21 am
Jeff Moden (11/14/2008)
SELECT COUNT(*) FROM Master.dbo.SysColumns
If it doesn't work, there are one of two problems... either you don't have the privs to read from the master database (very...
November 17, 2008 at 3:09 am
You don't really need dynamic SQL for this. Try the following as your WHERE clause:
WHERE M.DateTransactionDue >= '01/01/1900' AND M.DateTransactionDue <= @AllocationEndDate) AND M.TransactionTypeID = 1
AND M.SalesOrderID = CASE WHEN...
November 14, 2008 at 9:08 am
Or ISNULL:
CREATE TABLE #Orders (orderid INT, shipto VARCHAR(3), locationid VARCHAR(3))
INSERT INTO #Orders (orderid, shipto, locationid)
SELECT 1, 'acf', 'fcd' UNION ALL
SELECT 2, NULL, 'acf' UNION ALL
SELECT 3, 'dre', 'acf'
CREATE TABLE...
November 14, 2008 at 9:01 am
So what happens if there are several pairs of brackets, some with numbers in?
This picks the string between the first pair of brackets and grabs the numbers from it, but...
November 14, 2008 at 8:37 am
Dooza (11/14/2008)
I prefer Chris's solution, it returns the decimal just like I needed 😀
Seth's is almost identical identical apart from the datatype of the return value. He did what you...
November 14, 2008 at 8:01 am
Garadin, that's uncanny! I was working on this earlier and came up with the following:
CREATE FUNCTION [dbo].[uftGetNumbersInBrackets]
(
@String VARCHAR(50)
)
RETURNS DECIMAL (10,2)
AS
BEGIN
DECLARE @NewString VARCHAR(50)
SET...
November 14, 2008 at 7:44 am
asaacks (11/13/2008)
November 13, 2008 at 4:14 am
A LEFT JOIN is often faster than a NOT IN...
[font="Courier New"]SELECT p.PartNum,
p.PartDescription,
b.BinNum,
b.OnHandQty,
c.Cost,
b.OnHandQty * c.Cost AS ExtCost
FROM @Part p
INNER JOIN @Cost c ON p.PartNum=c.PartNum
INNER JOIN @Bin b ON...
November 12, 2008 at 9:48 am
meichner (11/10/2008)
November 10, 2008 at 7:25 am
Johann Montfort (11/10/2008)
working excellently nowbut in the where clause why just
WHERE p.Deleted = 0
If you have branches.deleted = 0 in the WHERE clause, then your output will have exactly...
November 10, 2008 at 4:57 am
Hi Johann
Your problem was almost certainly caused by including the deleted filters in your where clause. Put them into the join conditions instead:
[font="Courier New"]SELECT TOP (100) PERCENT
ISNULL(p.productID, 0)...
November 10, 2008 at 4:38 am
Hello
Try using proper join syntax, it will help to understand what's going on and will also give you a better insight into your data:
-- this will return all rows from...
November 10, 2008 at 3:40 am
smunson (11/6/2008)
You might want to make mention that your function relies on a "tally table" called "Numbers", as the OP here may or may not be familiar with that or...
November 6, 2008 at 9:39 am
Use a function to return the list as a table variable:
[font="Courier New"]CREATE FUNCTION [dbo].[uftSplitString]
(
@String VARCHAR(8000),
@Delimiter VARCHAR(255)
)
RETURNS
@Results TABLE
(
SeqNo INT IDENTITY(1, 1),
Item VARCHAR(8000)...
November 6, 2008 at 9:17 am
Viewing 15 posts - 9,421 through 9,435 (of 10,144 total)