Is it possible to find out who called a store procedure. So if you get an error in proc3, I know if it was called by proc1 or proc2.
I'm using SQL Server 2005.
Can any one tell me the LINQ 2 SQL version (in vb.net) of the below Left outer join query.I am trying to get all Employees with name "Shyju" and their address line 1 if it exist in the address table
SELECT E.EMPLOYEE_NAME,
E.AGE,A.ADRESS_LINE1
FROM EMPLOYEE_MASTER E
LEFT OUTER JOIN
ADDRESS_MASTER A
ON E.ID=A.EMPLOYEE_ID
WHERE E.EMPLOYEE_NAME='Shyju'
Thanks in advance
In SQL Server, it is possible to test the result of a stored procedure to know if the result return rows or nothing ?
Example :
EXEC _sp_MySp 1, 2, 3
IF @@ROWCOUNT = 0
BEGIN
PRINT('Empty')
END
ELSE
BEGIN
PRINT(@@ROWCOUNT)
END
But @@ROWCOUNT always return 0 so maybe is there another way of doing this ?
According to the following description i have to frame a case ...End statement in Sql server ,help me to frame a complex case..End statement to fulfil the following condition.
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.ELIGIBILITY is null then display display 'Favor'
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.EL is equal to No, display 'Error'
if PAT_ENTRY.EL is Yes and DS.DES is equal to null or OFF, display 'Active'
if DS.DES is equal to N, display 'Early Term'
if DS.DES is equal to Y, display 'Complete'
Thanks in advance.
How do I return the everything in a string from a sql query before a certain character?
My data looks like this:
HD TV HM45VM - HDTV widescreen television set with 45" lcd
I want to limit or truncate the string to include everything before the dash.
So the final result would be "HD TV HM45VM"
Hello everyone,
I am using SQL Server 2008 Enterprise and using the new Merge statement. From my experiment, I find source is always read only (table content not modified, i.e. no record is deleted/inserted/updated)? Is that correct understanding?
thanks in advance,
George
I have a stored procedure which is returning me about 50 columns. I want to write a query, where I will be able to select a particular column from the list of column returned by the SP.
I tried writing select RSA_ID from exec(uspRisksEditSelect '1') But Its throwing me an error.
I think we need to write some dynamic sql for it. But I am new to it.
Hello everyone,
I am using Linq-to-Sql for a C# application and am currently working on some stored procedures. The application is for a newspaper, and a sample stored procedure is the following:
ALTER PROCEDURE dbo.Articles_GetArticlesByPublication
@publicationDate date
AS
SELECT
*
FROM
Articles
WHERE
Articles.PublicationDate=@publicationDate
Anyway, this query gets all of the articles where the publication date is equal to the argument (publicationDate). How can I alter this so that the argument can handle multiple publication dates?
Also, I'd prefer not to use "BETWEEN," rather, I want to pick and choose dates.
Hi,
Can some one please guide me to understand which jar file i need to include in my application to be able to set up a jdbc connection with ms sql server.
thanks in advance.
Hi,
I have two servers where I installed SQL Server 2008
Production: RAID 1 on SCSI disks
Test: IDE disk
When I try to execute a script with about 35.000 inserts, on the test server I need 30 sec and instead on the production server more than 2 min!
Does anybody know why such difference? I mean, the DB is configured in the same way and the production server has also a RAID config, a better processor and memory...
THANKS!
I'm looking for a tool that that I can use to clean up (formatting, tabs etc...) my stored procedures and views. Is there anything like html's tidy, but for SQL which is free/open source?
How do I prevent SQL injection when it comes to ColdFusion? I'm quite new to the language/framework.
Here is my example query.
<cfquery name="rsRecord" datasource="DataSource">
SELECT * FROM Table
WHERE id = #url.id#
</cfquery>
I see passing in url.id as a risk.
Hi.
I am new to this cubes concept in SQL Server. I need to connect to cubes and query and get a result and display that result in grid view
Any help would be great telling how to connect to a cube, articles on it, code any thing that can help me to achieve the result
Thank you.
I have developed my own word breaker for SQL 2005 and the Full Text Search feature. I know how to use it by simply hijacking an existing language and add the wordbreaker to the registry for the hijacked language. However I'm not completely satisfied with that solution. I want to create a completely new language is this possible?
I have a computer working as a server with many SQL Server 2005 databases in it since two years ago.
Today, I don't know why, when I try to connect locally to any of the databases it gives me that error. It fails even if I'm logged in using Windows Authentication or as 'sa' user. It just wouldn't let me access the databases' info.
Could anybody explain me what's going on?
I am reading though the sql server 2008 bible and I am covering the views section. But he really dont explain the purpose of views. What is a good use for views. Should I use them in my website and what are the benefits of them.
hi!
Is there a way to insert only date in a datetime column in sql server without the time?
for example
date (datetime)
===============
12-01-2000
16-02-2000
or i should store this as a varchar and cast it when retriving so that i can convert to whatever form i need.
For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.
What is the optimal way to create such a function?
I want to be able to perform a IF...THEN in an SQL SELECT Statement.
For Example;
SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product
Hi Experts,
I have a tables with data like this
Id BookId TagId
34 113421 9
35 113421 10
36 113421 11
37 113421 1
38 113422 9
39 113422 1
40 113422 12
I need to write a query (SQL Server) which gives me data according to the tags say if I want bookIds where
tagid =9 it should return bookid 113421 and 113422 as it exists in both the books, but If I ask data for tags 9 and 10 it should return only book 113421 as that is the only book where both the tags are present.
Thanks
Parminder
Question: The new SQL Server 2008 database returns me values formatted English (date/float).
Is there a way I can set the return format ?
For example temporarely switching the database language?
Or just set the language for the current query ?
Hi,
I just noticed that if I have an identity column in a table, when I insert new rows SQL Server 2008 is automatically filling up the sequence if there are discontinuity. I mean, if in my identity column I have 1,2,5,6 if I insert other two rows in the table the system puts automatically 3,7 in the identity column.
Do you know how to control this behavior?
THANKS