I have written following stored procedure. If I don’t use IF ELSE block Order by clause works fine but I need to use IF ELSE to build my select statement. Order by Is not working with IF else block. Can you please tell me what am I doing wrong?
Thanks in Advance!
ALTER PROCEDURE [dbo].[GetLookupItem]
-- #description Gets LookupItem
-...
I am getting an error when I run this query because the data type money can't be implicitly converted to a varchar. However, I am using an if statemnt to make sure the data type is not money before I try the conversion. Clearly, the conversion is being executed anyways. Anyone know why?
table: BBH_NEW col: rebate2
datatype: money
if...
I have a SQL Server 2008 on a server which goes out on the internet through a domain name computer.example.com, I want to develop a .net app on my PC and to connect to that database through SSMS - to create tables and so on...
And I still want a connection string which can be accessed from anywhere - I'm thinking at a http ...
Please visit http://www.stumbleupon.com/
It asks you what interests you.
I would have a similar thing on my website except I would need to have 4 of such non-identical blocks. When a user has not selected anything in a section, it means s/he has selected all of them. 1 block would have around 10 options while the other 3 would have ...
I'm working on a query with a varchar column called ALCOHOL_OZ_PER_WK. Part of the query includes:
where e.ALCOHOL_OZ_PER_WK >= 14
and get the errors:
Arithmetic overflow error converting varchar to data type numeric.
and:
Error converting data type varchar to numeric.
Looking into the values actually stored in the column, the larg...
I have a table with two integer columns and a bit column. How can I put a constraint on the table so that it will not allow duplicates with the combination of two integers with a true. For example:
1 2 True
1 2 False
1 2 True ------> This should not be allowed
...
I try to do the following:
Detach the database
Copy files to a temporary folder
Attach the database again
This works the first time, but when I try to run this method a second time from the same process I get an error. I can always access the databse that was attached again from other clients, but not from within my application.
The...
Here's an interesting problem, and I'm looking for a pattern that will keep it all workable.
I am building a smart-client app for a school system. It will contain information about students including their report cards, sick days, and so forth. it will generate student-level reports, including their report cards, each rich with very p...
i have a SSRS 2005, now i upgraded to SSRS 2008 using VS 2008(automatically done by VS 2008 when i opened the solution),
but in printing first two pages printing correctly, from then on each page dividing in multiple pages(only one line in one page remaining in other page)
why it is dividing like this and how to overcome this?
...
It would appear that the functionality to add shortcut keys in SSMS2008 is mostly implemented, however, I don't seem to be able to shortcut key to anything.
For example,
Tools --> Customize --> Commands --> File --> New Query
Clicking on New Query and pressing the "Keyboard..." key simply opens up the Options screen. (In most MS IDE'...
hi can someone recommend a book that gives a good curriculum of how to do sql in sql server 2008?
...
In SQL Server is it possible to perform table partition without having to recode or modify the application?
...
I'm doing merge replication in sql server 2008 to synchronize the database between two systems. I added only tables to replicate initially. Successfully it is synchronizing.
Now the problem is whenever I'm adding new article say adding stored procedure, the snapshot is starting from scratch. Meaning, it is creating article from the ta...
The table contains a PRIMARY KEY column and another column which is FOREIGN KEY. This works fine. When I attempt to add another column as a FOREIGN KEY I get the following message:
Link to pic
...
Hi all,
I have a query to split the data but it is based on a delimiter. My query is:
DECLARE @xml xml,@str varchar(100),@delimiter varchar(10)
SET @str= 'VINAYKUMAR,VINAYKUMAR,VINAYKUMAR,VINAYKUMAR,VINAYKUMAR,VINAYKUMAR,VINAYKUMAR'
SET @delimiter =','
SET @xml = cast(('<X>'+replace(@str,@delimiter ,'</X><X>')+'</X>') as xml)
select @x...
Hello,
So I'm currently working on a project that involves the collection and storing of some huge datasets (as far as what I'm used to working with). The data essentially consists of meta information, and then actual values (where the values are trended over time).
The meta information itself is relatively large, but nothing huge, I w...
I have a huge database in production environment which I need to take a copy off, but the problem is that the data is over 100Gb's and downloading a backup off it is out of the question. I need to get a "skeleton" image of the database. What I mean by "skeleton" is, I need to get the database outline so that I can recreate the database...
Please visit http://www.stumbleupon.com/
It asks you what interests you.
I would have a similar thing on my website except I would need to have 4 of such non-identical blocks. When a user has not selected anything in a section, it means s/he has selected all of them. 1 of these blocks would have around 10 options while the other 3 woul...
Is there a way of finding out when the data was last entered into a table? I'm trying to find obsolete tables within my database and would like to know if there is a simple script(s) that I can run?
...
Is it possible to find out when a Stored Procedure was last accessed?
I tried the following:
SELECT *
FROM sys.dm_db_index_usage_stats
WHERE [database_id] = DB_ID()
AND [object_id] = OBJECT_ID('stored procedure name')
and it returns a blank resultset.
...