Minus Sign ()
Jun 2, 2007Hello:
I need to change minus brackets () with - sign in SSRS. How i can do this?
Thanks
Amit
Hello:
I need to change minus brackets () with - sign in SSRS. How i can do this?
Thanks
Amit
If I was asked "How many days passed" the query is (below) and the answer is 33. But, then the curve ball is "can you subtract out the weekends?" and I said....well, I said I think so, but not sure how. So far, I have had no luck. Any advise?
SELECT
DATEDIFF ( dd , dbo.table_case.creation_time , dbo.table_close_case.close_date ) AS no_of_days,
dbo.table_case.id_number,
dbo.table_case.creation_time CreateTime,
dbo.table_close_case.close_date CloseDate
FROM
dbo.table_case,
dbo.table_close_case
WHERE
dbo.table_close_case.last_close2case=dbo.table_case.objid AND
dbo.table_case.id_number = '969382'
ORDER BY no_of_days ASC
Hi,
I was wondering if anyone knows a command that will select all fields in a table except one?
Thanks!
Lee
Hi,I've used the minus functionality which is available in Oracle andi would like to use it in SQL server, but i don't know how to. Thefolllowing is how it works in OracleSelect symbols from symbol_tableminusselect tsymbols from tradeIt returns a list of all the symbols from symbol_table which are notpresent in trade.Similarly, the intersect will return only those which are common toboth.I was wondering if someone throw some light on this problem for me.Thanks in advance,Sumanth
View 1 Replies View RelatedHi,
I've to translate this SQL-Statement from ORACLE to SQL-Server. But I'm missing the Minus-Statement on SQL-Server.
select table_name, column_name from user_tab_columns
where table_name not in ( select table_name from user_tab_columns
minus
select tab_name from data_dic
)
minus
select tab_name, col_name from data_dic
what can I do to run it on SQL-Server.
Thanks in advance
Raimund
Hi,
Is there something equivalent to the MINUS in ORacle ?
Or a workaround ?
thanks
I would like to get a feed back from people who using Express edition.
What are the Plus and Minus points which you can list agenst Express Edition of MsSQL !
Please list them from your experiance rather than the documentation!
NB:- Specify : OS - Development Platforms - If any installation problems found in your Desk.
Thank you.
Thank you.
Hi
I am currently trying to import data from a table in 1 database into a table of the same name in another database. This in it's self is simple, however to add a twist to the proceedings there is data that exists in both tables. I just want to import the data that doesn't exist in the table I am importing into.
Please can you advise as to the best method to use
Many thanks
Paul
The charindex can run this
LEFT([Description], CHARINDEX('(', [Description]) + 1) as NewDesc,
But I can't run
LEFT([Description], CHARINDEX('(', [Description]) - 1) as NewDesc,
Hi I was hoping you could help,
I have a query that pulls back a customers account statement, however the credits are coming back as positives as well, So I am getting wrong figures, how can I correct the code below so that VAT, Goods Value and Total are negative if the data in column "trans reference" begins with a C for example C123456789 a invoice would be 123456789
Thanks
Code Snippet
SELECT
SLCUSA as [Compny Number],
SLCUSB as [Customer Suffix],
SLDELN as [Deliber To Number],
SLCNAM as [Customer Name],
SLDATE as Date,
SLTREF as [Trans Reference],
SLGDSV as [Goods Value],
SLVATV as [VAT],
SLTOTV as Total
FROM LIVEAS400.S65C422B.WRFDTA.SQLSLDGR
WHERE (SLCUSA = 2) AND (SLCUSB = 1007)
END
I got a table where i need to add certain rows and minus the valu with a row.
IDC1C2C3C4C5C6
1551557775
266201452
345222266
441727582
532556951
6022022
7182344142
8
Result in the 8 Row
Sum(id(2,3,4)-sum(id(6,7))
I have two tables CarType & Cars. Table CarType has a column CarTypeId which is the primary key (int, identity). Table Cars includes a column CarTypeId (int) which is a foreign key into the CarType table.Now I am trying to build a list of all those CarTypeId entries (from the CarType table) for which there are no Cars (i.e. there is no corresponding entry in the Cars table).I read that there is an SQL "MINUS" keyword that you can use like this:
SELECT CarTypeId FROM CarTypeMINUSSELECT CarTypeId FROM Cars..So if CarType contains records with the keys {1, 2, 3, 4, 5} and Cars contains records with the foreign keys {2, 4} (using set notation), your result should be the set {1, 3, 5}. (Note: I have tried alternate versions of this where I selected the DISTINCT CarTypeId entries from Cars, and where I sorted them; results same in both cases).I tried it in SQL Server 2005 Express. The result is just {1, 2, 3, 4, 5}.
Is the MINUS capability supported by SQL Server? I know that there are all sorts of different SQL dialects & implementations and that SQL has evolved & transmutated over the years; perhaps they opted to leave this out of SQL Server..
Here's a reference to the website where I initially found out about MINUS: [URL] ....
Have the following in my SELECT Stataement
CASE WHEN com.completion_date IS NOT NULL AND dim.DayName <> 'Saturday'
THEN DATEDIFF(d, com.current_task_target_date,com.completion_date) - non1.NoWorkDays
WHEN com.completion_date IS NOT NULL AND dim.DayName = 'Saturday'
THEN DATEDIFF(d, com.current_task_target_date,com.completion_date)
ELSE NULL
END AS 'DaysOverTarget'
Some of the figures coming back are minus figures. How could I get the minus figures reported to be 0.00?
Below is the full TSQL
SELECT DISTINCT com.comm_reference AS 'Referance'
,com.crt_date AS 'CreatedDate'
,com.current_task_target_date AS 'TargetDate'
,com.completion_date AS 'CompletionDate'
,CASE WHEN com.completion_date IS NOT NULL AND dim.DayName <> 'Saturday'
THEN DATEDIFF(d, com.crt_date,com.completion_date) - non.NoWorkDays
[Code] .....
I have been tasked with writing a report that shows all open orders for an item and their quantities, along with a running total of what is left in stock. We start by building these two tables:
IF OBJECT_ID('tempdb..#Orders', 'U') IS NOT NULL DROP TABLE #Orders;
IF OBJECT_ID('tempdb..#Warehouse', 'U') IS NOT NULL DROP TABLE #Warehouse;
CREATE TABLE #Orders (OrderDate DATETIME, JobNumber NVARCHAR(10), Item NVARCHAR(20), QtyOrdered NUMERIC(10, 2))
INSERT INTO #Orders SELECT '20150801', 'JOB1', 'Widget1', 5
INSERT INTO #Orders SELECT '20150802', 'JOB2', 'Widget1', 3
[code]....
Hello,
I am using the following expression to access a daily file.
"D:\importdata\peregrinedata\ACD_DATA_" + (DT_WSTR, 4) YEAR( GETDATE() ) + (DT_WSTR, 2)MONTH( GETDATE() ) + (DT_WSTR, 2) DAY( GETDATE() ) + ".txt"
output: D:importdataperegrinedataACD_DATA_2008123.txt
I need to have this file by current day -1. I've tried dateadd and can't figure out how to get it to work.
Thanks
SSRS 2005 on XP SP2
How does one format a date time parameter as, for example, today's date minus 7? Attempting to use:
=Today() - 7 throws the error "Operator '-' is not defined for types 'Date' and 'Integer'
Thanks in advance
I have a test query that i have ordered by the expected result order.
select t from (
select cast('1' as nvarchar(20)) as t
union all select '1---qa'
union all select '1q'
union all select '1q1'
union all select '1qz'
[Code] ....
and the question is... why is minus character (at 3rd line in '1---qa' string) ignored by "order by" clause? That row is put after '1q1' and not after '1'.
When you replace '-' with '+' or any other special char it works as expected but not with '-'. It is just ignored no matter if there is one or more of them.
Don't mind local chars like čž, they are for testing purposes with collate (thus commented) and with bin collation that is not doing proper sorting but minus order is ok in that case.
Tested on SQL 2008 R2 and SQL express 2012, database collation is 'Croatian_CI_AS'.
Hi Guys,
I have a website with multiple pages and when a user signs in it puts a 1 in the database and their online status is shown to the rest of the members, if they use my signout button which I have on each page, it signs them out and updates the database with a 0 in the process, so shows them as then offline, my problem is some people forget to sign out and just close the browser window or begin surfing elsewhere.
Is there a way to have sql server 2000 automatically change the field in the database after 30 minutes of inactivity.
Or is there a way to automatically sign users out as they either click on the X in the browser window, or as they leave my site.
Any help would be appreciated.
Cheers
Hello,
Is there any built in function to find out the sign of a value.
For Ex: -225.89 Sign is -
566.987 Sign is +
Thanks
Ganesh Kumar
Solutions are easy. Understanding the problem, now, that's the hard part
I typed the following query
ALTER TABLE [konnik].[PORTAL_CONFIG]
ADD CONSTRAINT [DF_PORTAL_CONFIG_AUTOPM_ON]
DEFAULT (1) FOR [AUTOPM_ON]
and i received the following warning
Warning: The table 'PORTAL_CONFIG' has been created but its maximum row size (12068) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.
Bear in mind that this table come from Access through the Dts. Could anyone translate this for me? How can i overcome this???
i found one tutorial on self signing assemblies for use in sql server, but it appears to have errors. does anyone know of a better tutorial on this topic? the site im currently looking at is here: http://www.sqljunkies.com/WebLog/ktegels/articles/SigningSQLCLRAssemblies.aspx
View 1 Replies View RelatedHi i am trying to get the following result:
CALCULATE THE CURRENT NUMBER OF SHARES on base of number of shares bought and number of shares sold
so the logic is
int total
if transactiontype is "buy", total = total + amount bought
if transactiontype is sell, total = total-amount sold
plus must be grouped by share
base data are stored in 1 table as
share name transaction type share amount
tesco buy 200
tesco sell 50
sounds rather easy does it not?
well sql syntax must be very foreign to me as i do not manage it
I tried a few options:
1 to write a database function as above and then call it from sproc
but i need to use group by share name or id so it calculates for each share and it will not let me to use function in select with group by
2 i tried to use if within sproc but i get complain incorrect syntax (I use MSDE database accessed via Visual) - I think it suppose to be possible but it throws me out with the most simple if or = is there some special syntax?
3 I created 2 views: 1 view: all sold shares, 2nd view: all bought shares and their bought/sold quantities
as in
select share name, sum(sharequantity)
where transaction = sell
from table
group by share name
and the same for purchases
then I did union of these 2 views with boughtquantity - soldquantity what worked but it only showed me shares which were sold, if share was never sold it was not shown I guess due to union
so I am still stuck!
I have a field in table A named tbl_dob.It is date of birth of member. I want to find zodic sign from this tbl_dob.How I get it.Please help me.
View 1 Replies View RelatedHi
I have come across a bit of problem with my Web Form. I have standard textbox which inserts a value into a SQL 2000 database. However if I put a pound sign anywhere inside the text box and do the insert it disappears when I try and reshow the value.
I have checked the database field to see if it has been inputted but its no where to be seen.
So what has happened to my pound sign? any ideas?
I am using VS.Net 2003.
Thanks in advance
I have a SQL 7 db that I use a DTS package to import Oracle data into. The package works fine and imports all the appropriate data. However, if I use an Access 2000 database to attach to the data via ODBC (using the MS SQL Server driver), the negative sign is dropped when displaying data in a table, query, or report.
Same problem in SQL Server - if I query the SQL 7 data via the Query Analyzer, the negative signs are dropped. However, if I query the SQL data using the Enterprise Manager (i.e., Open Table...Return All Rows via right click on the table), the data shows up properly with the negative signs there. Bottom line - the data is correct, but doesn't get displayed correctly in QA or via ODBC.
What gives?! Can anyone explain to me the "connections" that occur between EM and QA? Looks like QA uses a "temporary" ODBC connection to talk to the data, while the EM connects "directly" to the data. Also, what gives with the MS SQL Server ODBC driver - why wouldn't it display the negative signs? Is there a better SQL Server ODBC driver that I should/could use? I've tried configuring the ODBC connection differently, but to no avail.
Any help is greatly appreciated, as the data in question is being used in court and absolutely HAS to be accurately displayed.
Thanks!
Jeff Jones
Atlanta, GA
Does anyone know to include the Euro sign in SQL statements. I found an Ascii
code of ALt+0128, but then I use CHAR (0128) it actually prints the Char (128) which is not .
When I use the directly in the code the application just shows a ?
Any help would be highly appreciated.
Markus
Code:
objrs.Open "Select * from [klcc_f$]", objConn, adOpenStatic
why IM getting dollar sign is not a valid name ?
I am trying to use this command to change the variable in where clause each time:
psexec servername -E cmd.EXE /c "sqlcmd -S servername /E -d dbname -v entertext="'%anything%'" -i c:myfoldermyscript.sql -o c:mypathoutput.sql"
myscript.sql is like:
select * from table_name
where summary like $(entertext);
This command works just for variables with single and exact word. It does not work for variables which has space between them or when I enter part of summary.In fact, I wanted to write something which the user be able to enter variable each time when he/she run this batch file. because I put this sqlcmd command in batch file( like this in oracle: "select * from table_name where summary = &entertext; " I was looking the same command in sql server , but I did not find it). I do not know .net or any other programing language( I know just csh and command line). I want to do this just with sql command.
I have a query where I have to use the convert function to return the unitprice as a decimal with 2 digits to the right of the decimal and a $ to the left of the number like 10 should be $10.0o. How do i insert the $. this is my code so far:
SELECT CONVERT(varchar, UnitPrice, 1) AS varchartotal
FROM dbo.[Order Details]
I'm trying to import a text file which contains dates and decimal values. My problem is that the date has the following format "YYYY-MM-DD" and the decimal sign for the values are "." (dot).
If I change the "Locale" for the file source so it will handle the "." signs in the values then the dates are invalid, and if I have it so the dates are handled then the "."s aren't seen as decimals.
Is it posible to handle this problem in SSIS
Thanks
In Crystal Reports, there was a "reverse sign for display" property that could be checked for a number box. This was used for debits and credits (and such) so a negative number would be displayed as a positive and a positive displayed as a negative.
How would this work, or is there something simple, in Reporting Services?
Thanks for the information.
Just lately I have noticed that I am periodically getting signed out of this forum. When I try and sign back in I get directed to an error page saying:
We apologize, but an unknown error has occured in the forums.
This error has been logged.
I would say this has been happening for a couple of weeks now at least.
Has anyone else expereienced this?
Thanks
Jamie
Hi,
I did all the step mentioned in this MSFT article http://msdn2.microsoft.com/en-us/library/ms137947.aspx Yet I can not sign a package using a certificate.
To sign a package
In Business Intelligence Development Studio, open the Integration Services project that contains the package you want to work with.
In Solution Explorer, double-click the package to open it.
In SSIS Designer, on the SSIS menu, click Digital Signing.
In the Digital Signing dialog box, click Sign.
The Select Certificate dialog box, select a certificate.
Optionally, click View Certificate to view certificate information.
Click OK to close the Select a Certificate dialog box.
Click OK to close the Digital Signing dialog box.
To save the updated package, click Save Selected Items on the File menu.
I don't see a certificate to select after following the article's steps. Can some one please shed some light on this?
Thanks,
Saptagiri Tangudu