Is there any functionality which work in SQL Server Query similar to as EXCEL Financial RATE() Funtion.
Please suggest me any approach as how to receive the same result by SQL Server Query.
Related
So I have a DAX query that I have built in SSAS. But since my application like DAX, I thought pushing the set of DAX results to a database server table would be the ideal solution for my application to read.
How do I output the contents of a DAX query to a SQL Server database table? And if possible truncate the contents of the table before each run?
I'm using SQL Server 2016 if that helps.
I got around this by using a linked server to output the contents of an 'open query' to a table variable in SQL.
I'm not that experienced in sql server and even less so in using SSRS. I'm working with 2008 R2 edition.
Question: Is it possible to use a sql table that has expressions in a report, so that the report will evaluate the expressions before it is run? I just tried and the expressions don't get evaluated and show up as string. The expressions are stored as string in the sql table. Not sure if there is another way to store the expressions?
Thanks in advance for your help.
Cheers,
In SSRS, it sends the query to database engine and execute. Once the data is retrieved from database, the data is fixed. Then report will process the data and render it. And the query is executed only one time. You can't make the query re-process the expression within the cell again.
I have using Microsoft Query in Excel 2007 for the past few weeks and have had many cases where the query works fine in SQL Server 2005 but gives irrelevant errors in Microsoft Query. For example I have this case Multipart identifier error in Excel 2007 MS Query but not in SQL Server 2008 where when I removed the sub queries in SELECT and joined those tables it worked. It doesn't seem to work in this case too.
Pass parameters to temp variables in MS Query on SQL Server from Excel I guess CTEs don't work in MS Query like CTE in MS Query Excel 2007. It doesn't work in this case too. Alternative to Left Join
Can anyone list all the SQL Limitations in Microsoft Query?
I often found that queries that run on Oracle, AS400 and MS Sql wouldn't run on MS Query, I think the reason is because that MS Query always tries to display the query graphically. If the query is impossible to show graphically MS Query will display a waning message and then display just results (not the table or conditional panes). Simple queries work fine but there is a middle ground between complex and simple that MS Query seems to choke on.
The solution I found was not to simplify my queries, but to actually make them more complex thus forcing MS Query not to attempt a graphical display. I did this by making my queries a sub query and entering into MS Query like so:
SELECT * FROM (
--enter your query here
) a
I have had an odd error I cannot explain. Basically, I am running a query to my SQL database using excel and am having non-existent data pop up when it comes to a very particular order in my database.
Here is a simple query surrounding this order:
select * from OR200100 where OR200100.OR20001='0000793605'
Here is the output in EXCEL
And here is the same output in SQL
what is happening here? How could the same query generate 2 different results?
Run SQL Server Profiler against the database if you can, then compare the output to the sql query that you are running in ssms.
OK, so it's SQL Server then, that's important because different SQL products can have very different idiosyncrasies and controls.
The next things to check are these:
Is OR200100 a Table or a View? If it's a view then post it's code.
Are you using the same Login/account from both Excel and SSMS?
Are you sure that you are connecting to the same Server and Database? SSMS tells you what you are connected to, but client apps like Excel do not and it is very common for this type of problem to be caused by the app connecting to a Dev or QA version of the database. See here for some of the different ways that this can happen:
So I had a very similar problem, my query was grouping by week numbers. What I found was that one of the queries had set datefirst 5 set whilst the other didn't. I guess the key thing here is make sure, if you are using any SET operations in your ssms queries, these are identical to those in the Excel query string.
I have written SQL statements (stored in a text document) that load data into a SQL Server database. These statements need to be repeated daily. Some of the statements use the NewId() function to populate a keyed field in the database, and this works fine.
While I'm in the process of writing an application to replicate these statements, I want to use Access queries and macros instead of copying and pasting queries into SQL Server, thus saving me time on a daily basis. All is working fine but I can't find any function that will replace the SQL Server NewId() function. Does one exist or is there a work around?
I'm using SQL Server 2005 and Access 2007.
On top of matt's answer, you could simply use a pass-through query and just use your existing, working queries from MS Access.
A solution would be to insert the stguidgen() function in your code, as you can find it here: http://trigeminal.fmsinc.com/code/guids.bas https://web.archive.org/web/20190129105748/http://trigeminal.fmsinc.com/code/guids.bas
The only workaround I can think of would be to define the column in your access database of type "Replication ID" and make it an autonumber field. That will automatically generate a unique GUID for each row and you won't need to use newid() at all. In SQL server, you would just make the default value for the column "newid()".
Again, there seems to be confusion here.
If I'm understanding correctly:
You have an Access front end.
You have a SQL Server 2005 back end.
What you need is the ability to generate the GUID in the SQL Server table. So, answers taht suggest adding an AutoNumber field of type ReplicationID in Access aren't going to help, as the table isn't a Jet table, but a SQL Server table.
The SQL can certainly be executed as a passthrough query, which will hand off everything to the SQL Server for processing, but I wonder why there isn't a default value for this field in SQL Server? Can SQL Server 2005 tables not have NewId() as the default value? Or is there some other method for having a field populate with a new GUID? I seem to recall something about using GUIDs and marking them "not for replication" (I don't have access to a SQL Server right at the moment to look this up).
Seems to me it's better to let the database engine do this kind of thing, rather than executing a function in your SQL to do it, but perhaps someone can enlighten me on why I'm wrong on that.