15,908,906 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mhwasim (Top 21 by date)
mhwasim
28-Mar-12 7:22am
View
Pass Null value not empty string or set the initial values in sp to -1 and pass -1. modify the where clause respectively...but if u set to "" then u'll have to handle this scenario in sp code as well to make it work otherwise it will look into table values.. Integer values cannot be set empty strings or "" set to null
mhwasim
27-Mar-12 8:35am
View
pseudo something like bleow
IF EXISTS (select null from table1 where column1 = @Val)
BEGIN
UPDATE table set column2 = @NEWval where column1 = @Val
SELECT 'Rec updated'
END
ELSE
SELECT 'Rec not found'
mhwasim
27-Mar-12 8:20am
View
this definition will do this for u
CREATE TABLE dbo.PROD_INVENTORY
(PROD_GRP_ID int,PRODUCT_ID int, QTY int,WAREHOUSE_ID int, INV_CAT_ID int)
INSERT INTO PROD_INVENTORY
SELECT 1,1,10,1,1 UNION ALL
SELECT 1,2,20,2,2 UNION ALL
SELECT 1,1,30,3,3 UNION ALL
SELECT 1,3,40,1,4
GO
ALTER PROCEDURE SP1(@wid int=null, @pgid int=null, @pid int=null, @invcat int=null)
AS
BEGIN
select PROD_GRP_ID,PRODUCT_ID,WAREHOUSE_ID, QTY from PROD_INVENTORY
where (WAREHOUSE_ID=@wid or ISNULL(@wid, -1) = -1 ) and
(PROD_GRP_ID=@pgid or ISNULL(@pgid, -1) = -1 ) and
(PRODUCT_ID=@pid or ISNULL(@pid, -1) = -1 ) AND
(INV_CAT_ID=@invcat or ISNULL(@invcat, -1) = -1)
END
GO
sp1 1,1,1,1
i used to simulate it with above example
mhwasim
27-Mar-12 6:33am
View
pls check the expected sp definition I have sent to u in early post...
make the use of OR and AND as per ur requirement
mhwasim
27-Mar-12 6:30am
View
can u provide an example?
mhwasim
27-Mar-12 5:57am
View
ur expected sp definition should be like below
ALTER PROCEDURE SP1(@wid int=null, @pgid int=null, @pid int=null, @invcat int=null)
AS
BEGIN
select PROD_GRP_ID,PRODUCT_ID,WAREHOUSE_ID, QTY from PROD_INVENTORY
where (WAREHOUSE_ID=@wid or ISNULL(@wid, -1) = -1 ) and
(PROD_GRP_ID=@pgid or ISNULL(@pgid, -1) = -1 ) and
(PRODUCT_ID=@pid or ISNULL(@pid, -1) = -1 ) AND
(INV_CAT_ID=@invcat or ISNULL(@invcat, -1) = -1)
END
mhwasim
27-Mar-12 5:29am
View
How u r passing the arguments? Execute the query seperatly by passing those arguments in where clause and c if it returns any records...
mhwasim
9-Mar-12 6:58am
View
Please read the following article
http://msdn.microsoft.com/en-us/library/ms190439.aspx
mhwasim
17-Jun-11 9:30am
View
Deleted
This will only take care of spaces and dots....but he can't do any thing for spelling mistakes as that column in excel sheet was free text....It has to be manually fixed...
mhwasim
24-May-11 8:37am
View
I have created a CLR to get this done on SQL 2005....It works for me...
Thanks for all of you to helpme on this....
mhwasim
23-May-11 14:04pm
View
My appologies......I was busy on some other work and didnt notice about it....Thanks for the correction...
mhwasim
23-May-11 12:02pm
View
its for SQL 2K8...will not work in SQL2K5..check my comments in solution 1...I already mention it
mhwasim
23-May-11 11:55am
View
It is clear that I want the date time value like the following format
2011-05-23 19:43:32.7577956 +05:00
in SQl 2008 we can get this by SELECT SYSDATETIMEOFFSET()
and in SQL 2005 the workaround is
DECLARE @OffsetValue int;
SET @OffsetValue = (SELECT DATEDIFF(hh, GETUTCDATE(), GETDATE()));
SELECT @OffSetValue AS [TimeOffset];
I want to know if there is a function which will give me this value directly without any calculations...
mhwasim
18-May-11 13:31pm
View
view can be used to update a record.....delete cannot be performed
mhwasim
18-May-11 12:19pm
View
sps are always pre-compiled...its the code which is pre-compiled....for Execution plan if u use some statements like EXEC it will then always create execution plan every time when called...
mhwasim
18-May-11 9:44am
View
The above solution has 2 issues
1. The query SELECT Something FROM AnotherTable WHERE MyTable.Field2 = AnotherTable.AnotherField should not return more than 1 record
2. if No data found then Field1 will be poopulated with Null which I dont think so is rite solution.
mhwasim
17-May-11 6:38am
View
Could you pls vote my solution if it helps you....Thanks
mhwasim
12-May-11 5:48am
View
This has been fixed..pls check..Thanks
mhwasim
11-May-11 9:32am
View
Question is either not complete or nto cleared
mhwasim
11-May-11 9:25am
View
I have added a solution. Kindly check it
mhwasim
11-May-11 6:01am
View
Is there any other relative field associated with it? The order you want it seems to be having some custom criteria. Can you share the logic of this sorting list?
Show More