[SQL Server] Query by current month |
- Query by current month
- INSERTING PROBLEM
- how to add output parameter to existing sproc
- Conversion failed due to datatype.
- Invoke Batch file from Remote machine
- Migration of Maintenance Plans - Server to Server
Posted: 11 Jul 2013 07:58 AM PDT I am rather new to working with databases and queries. That being said.....I am trying to pull data in from an Oracle data base into an excel spread sheet. I already have the connections and everything, but I cant seem to figure out how to restrict the data to only that in the current month. I know i need to add a "where" clause to my query, but I cant find the proper one to insert. can someone help me out with this? the field that this is bassed off of is a date time field. |
Posted: 10 Jul 2013 04:11 PM PDT CREATE TABLE MYTABLE( NAME NVARCHAR(MAX), ID INT)INSERT INTO MYTABLE(NAME,ID) VALUES('AAA',1)INSERT INTO MYTABLE(NAME,ID) VALUES('AAA',2)INSERT INTO MYTABLE(NAME,ID) VALUES('AAA',3)so the output is,NAME IDAAA 1AAA 2AAA 3in front end i am having checkbox listin that i selected 3 items then the values will come like this '4,5,6'after getting those selected value items i want to insert it into databasefor example,NAME='BBB'IDs='4,5,6'so my requirement is if i send these above values to MYTABLE in databasethen the expected output looks likeNAME IDBBB 4BBB 5BBB 6please help me ,your help will be appreciableThanks in advance,Venkatesh Desai.k |
how to add output parameter to existing sproc Posted: 11 Jul 2013 01:41 AM PDT I have been given a sproc which needs to have an output parameter added.It is the the line @UpdBearingStatusComplete INT OUT.when I type the name it has red squiggles under it and syntax check gives the error listed below.What am I doing wrong?ALTER PROCEDURE [dbo].[UpdBearingStatus] @BearingEtching VARCHAR(40), @BearingStatusHMIText Varchar(40)=NULL, @SpallSizeHMIText VARCHAR(40)=NULL, @TestSetID INT = 0, @Username VARCHAR(80)='SYSTEM', @ManualUpdateReason VARCHAR(255)=NULL--trying to add this line @UpdBearingStatusComplete INT OUT ASBEGINDECLARE @BearingID INT=0DECLARE @BearingStatusTypeIDNew INTDECLARE @SpallSizeTypeIDNew INTDECLARE @BearingStatusTypeIDPrev INTDECLARE @SpallSizeTypeIDPrev INTfrom CheckMsg 102, Level 15, State 1, Procedure UpdBearingStatus, Line 18Incorrect syntax near '@UpdBearingStatusComplete'. |
Conversion failed due to datatype. Posted: 11 Jul 2013 01:16 AM PDT Hi,I am trying to generate ids as"Compidentity" as varchar .If the record is inserted with productcode- " Health"Column with value H1 shoul be added .If the record is inserted with " Dental "Column with Value D2 should be added.Here is what I have :( ProductCode Varchar(20), Compidentity int identity(1,1),status as casewhen productcode = 'Health'then 'H'+ cast(compidentity as varchar(20)) when productcode = 'Dental'then 'D' + cast(compidentity as varchar(20))else1end)Executes fine.But when I write an insert statement gives an error :" Conversion failed when converting the varchar value 'H1' to data type int."Please advise. |
Invoke Batch file from Remote machine Posted: 10 Jul 2013 04:48 PM PDT Hello,I have created a batch file to restart one of the SQL Server service and I would like to invoke it from a remote machine.Is it possible??If yes,how?I really appreciate all of you for attempting to help me out. |
Migration of Maintenance Plans - Server to Server Posted: 10 Jul 2013 06:58 PM PDT Hi All,I have setup some Maintenance plans over time and now am looking at installing a replacement server.Is there an easy way to migrate the plans over ( edit after if required ) Thanks |
You are subscribed to email updates from SQLServerCentral / SQL Server 2008 / SQL Server Newbies To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment