Trying To Work With Timestamp Stored As Integer (11:17 Am -&&> 1117)
Nov 7, 2006
My company uses some integration software to synchronize tables in our OpenVMS server to our MS SQL 2005 server so statistics and tasks can be performed there instead potentially impacting our main data processing operations.
The problem I'm running into is that timestamps in the tables are stored as date_shipment (datetime) and time_shipment (integer) instead of as a combined datetime_shipment (datetime). Date_shipment contains the date of the transaction with 00:00:00.000 for the time part, while time_shipment has the time of the event stored as an integer, so 8:00 am -> 800, 4:50 pm -> 1650, 8:00 pm -> 2000, etc.
Unfortunately, I'm stuck with what the integration software gives me, so I need to find some way of turning the time integer column into a real time that I can then combine with the date.
Does anyone know of a way to do this? I haven't had any luck while experimenting with different T-SQL yet.
Thanks,
Jason B.
View 1 Replies
ADVERTISEMENT
Jul 5, 2007
I have this block of code that is supposed to go out to a SQL2k5 Express DB, get the number value from a record based on a request.querystring containing the table ID number.I get the request.querystring and store it in a variable. By nature this is stored as a String data type.Then I try to convert the string into an integer using both the "Convert.ToInt32(IDNum)" and the "Int32.TryParse(Request.QueryString("ID"), IDNum)" methods.The IDNum variable is to be used to inject into a stored proc as shown below. conn = New SqlConnection(ConfigurationManager.ConnectionStrings("database_connection").ConnectionString)conn.Open()cmd = New SqlCommand("GetMyNumber", conn)cmd.CommandType = Data.CommandType.StoredProcedurecmd.Parameters.Add("@MyNumber", Data.SqlDbType.Int).Value = IDNumSession("EndResult") = cmd.ExecuteScalarcmd.Dispose()conn.Dispose()As you can see the result is to be stored into a session variable to be used later.My query works just fine when created as an actual query and I supply the numerical value of the record. So I know that's working. I know it is connecting to the db based on the debugging I've done. I just, for some reason, cannot get that data type to convert. So my questions are:1. How do I convert the queried ID number to an integer so that I can use it in my stored proc?2. In the end, can the result be stored in the session variable as I have shown or are the session variables only for string types?
View 4 Replies
View Related
Jul 20, 2015
Working on a new database where the Date and Time are stored in a Date Time Field.
Then working on an OLDER database file within the same SQL Database contains these 2 items as integers:
transDate = "71615" (July 16, 2015)
transTime = "12345" (01:23:45 AM)
How do we convert both of them into a single SQL DateTime field such as "2015-07-16 01:23:45.000" so that it can be used in a join restricting to a date time in a different SQL File that properly has the DateTime in it?
This works well for converting the transDate Part in the select statement:
dbo.IntegerToDate(at.transDate) as transDate
* That returns: "2015-07-16 00:00:00.000"
* The resulting data must work directly in a Microsoft SQL Server Management Studio Query using either using the "on" statement or part of the "where" clause. In other words, NOT as a stored procedure!
Also must be able to be used as a date difference calculation when comparing the 2 files Within say + or - 5 seconds.
View 3 Replies
View Related
Dec 10, 1999
Help,
we have error 1117 - Extent chain for object %ID is not correctly linked
Fortunately this is a temporary table, so we can drop it - or so we thought. The table will not drop!"!!
HELP How do I drop a table that does not 'want to be dropped'!!! There are no dependencies and I MUST have this temporary table available for the system to use.
gordon
View 2 Replies
View Related
Sep 16, 1999
I get the following message when I run a SQL database maintenace routine:
I got the following error message when I ran a SQL maintenance routine:
Table Corrupt: Extent is linked in more than one chain. Check the following allocation page and extent: alloc pg#=17408 extent#=17472 status=2
** Execution Time: 0 hrs, 0 mins, 2 secs **
MS said to run DBCC CHECKDB and DBCC NEWALLOC. CheckDB runs fine with no errors, however, NewAlloc gives me a similar message.
I deleted all data in the corrupt table and tried to drop it but still got a message about a linking problem.
Does anyone know how I can delete this table or a simle fix?
Thanks,
Dick
View 2 Replies
View Related
Jun 19, 2007
I am populating oracle source in Sql Server Destination. after few rows it fails it displays this error:
[OLE DB Destination [16]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description:
"Invalid date format".
I used this script component using the following code in between the adapters, However after 9,500 rows it failed again giving the same above error:
To convert Oracle timestamp to Sql Server timestamp
If Row.CALCULATEDETADATECUST_IsNull = False Then
If IsDate(DateSerial(Row.CALCULATEDETADATECUST.Year, Row.CALCULATEDETADATECUST.Month, Row.CALCULATEDETADATECUST.Day)) Then
dt = Row.CALCULATEDETADATECUST
Row.CALCULATEDETADATECUSTD = dt
End If
End If
I don't know if my code is right . Please inform, how i can achieve this.
View 6 Replies
View Related
Oct 10, 2005
Hi,I'm attempting to update one row using strored procedure which check timestamp field.
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'tbCharakterystyki_Update')BEGINDROP Procedure tbCharakterystyki_UpdateENDGO
CREATE Procedure dbo.tbCharakterystyki_Update@CH_ID int ,@CH_CHARAKTERYSTYKA VARCHAR(30),@CH_OPIS VARCHAR(300),@CH_TIMESTAMP timestampAS
UPDATE tbCharakterystyki SET ch_charakterystyka = @CH_CHARAKTERYSTYKA,
ch_opis = @CH_OPIS
WHERE ch_id = @CH_ID AND ch_timestamp = @CH_TIMESTAMP
GO
Function which call stored procedure:public int CallSP(DataRow dr) { try { SqlConnection conn = new SqlConnection(this.strConnection); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "dbo.tbCharakterystyki_Update";
SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@CH_ID"; p1.SqlDbType = SqlDbType.Int; p1.Value = dr[0];
SqlParameter p2 = new SqlParameter(); p2.ParameterName = "@CH_CHARAKTERYSTYKA"; p2.SqlDbType = SqlDbType.VarChar; p2.Value = dr[1];
SqlParameter p3 = new SqlParameter(); p3.ParameterName = "@CH_OPIS"; p3.SqlDbType = SqlDbType.VarChar; p3.Value = dr[2];
SqlParameter p4 = new SqlParameter(); p4.ParameterName = "@CH_TIMESTAMP"; p4.SqlDbType = SqlDbType.VarChar; p4.Value = dr[3];
cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.Parameters.Add(p4); cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); return 0; } catch ( Exception err ) { ShowError(err.Message) return null; } }
And function which call "CallSP()":private void Update(){DataSet ds = helper.GiveDataSetCharakterystyki()DataRow dr = ds.Tables[0].Select("ch_id=51")[0];
dr[1] = "new value";CallSP(dr);}When I fire Update(), stored procedure (dbo.tbCharakterystyki_Update) is not started, Sql Profiler doesn't show it.Whilst when I modify stored procedure, removing WHERE ch_id = @CH_ID AND ch_timestamp = @CH_TIMESTAMP and put only WHERE ch_id = @CH_ID , it works perfectly.What I did wrong?
View 1 Replies
View Related
May 9, 2008
I was comparing the parameters for two stored procs that I made using the SQL Server 2005 express management studio. Both of these sprocs only inserted one field into a single table. These were both of the type varchar.
One of the sprocs had "nocount on" and the other did not. I thought I would see the returns integer parameter in the sproc that did not have "nocount" set to on. I thought this is what returns an integer to validate an insert. Obviously, I am confused about how this works.
Can anyone help me to understand that difference between nocount on and the parameter that returns an integer.
Any help is appreciated.
View 1 Replies
View Related
May 4, 2006
hi there,
i need a procedure that works with C# e.g.:
using (SqlCommand cmd = GetCommand("Procedure_Name"))
{
//i=an array of integer values
cmd.Parameters.Add("@array", SqlDbType.????!?!???).Value = i;
cmd.ExecuteScalar();
}
i need to write a stored procedure that takes as input an array of integers (amongst other values)
this procedure must loop through every integer in the array and INSERT a new record into a table.
i have never used T-SQL before.
Many thanks
View 3 Replies
View Related
Jun 23, 2015
date time s-sitename TimeTaken(Seconds)
6/8/2015 10:56:26 TestSite 100
6/8/2015 10:56:26 TestSite 500
6/8/2015 10:56:26 TestSite 800
6/9/2015 11:56:26 TestSite 700
6/9/2015 11:56:26 TestSite 200
6/12/2015 12:56:26 TestSite 700
I have a table with above values, I am looking for a sql query to find AvgTimeTaken at different time stamps and total count of each time stamp
Output
date time s-sitename TimeTaken(Seconds) Count_of_Request
6/8/2015 10:56:26 TestSite 1400 3
6/9/2015 11:56:26 TestSite 900 2
6/12/2015 12:56:26 TestSite 700 1
View 5 Replies
View Related
Aug 18, 1998
Hello All,
I am getting an error 1117 in my server error log during a nightly load into our database. When I get this, I run a dbcc checalloc, and then a checktable and that appears to correct the problem in the short term. The error occurs randomly. I am also getting an error 2541 on about 3 tables. But, SQL Server won`t let me drop and recreate them. My question is...What can I do to correct this problem. Any help would be greatly appreciated.
View 1 Replies
View Related
Oct 24, 2007
ok...i give up.....
can this be done? (sql server 2000)
all i want to do is have my stored procedure output some data to a file and i want the filename to include a time stamp.
here's my current working file output code:
EXEC master..xp_cmdshell 'bcp "select * from CEData..employee" queryout "c:employees.txt" -c -Usa -P'
i'd like it to be something like this:
EXEC master..xp_cmdshell 'bcp "select * from CEData..employee" queryout "c:employees" + datetime + ".txt" -c -Usa -P'
but nothing seems to work.
View 16 Replies
View Related
Sep 17, 2007
I'm having problem on trying to execute a query in stored procedure that has parameters as a integer. The parameter with the integer is in the WHERE clause. If I take out the WHERE clause, it would work. If I take out the parameter and replace it with a value, it would work. I have try using the CONVERT function to convert it to an integer, still no luck.
Error: Unterminated String Constant.
What is the problem?
Set @strSQL='Select * From(SELECT Row_Number() Over(Order By ' + @SortExpression + ') as Row_Count,Rank() Over (Order By ' + @SortExpression + ') as TableInfo_ColumnSort,dbo.EVENT_LOGS.EVENTLOG_ID, dbo.USERS.USERNAME, dbo.EVENT_LOGS.ITEM_TYPE, dbo.EVENT_LOGS.SCREEN_ID, dbo.EVENT_LOGS.CHANGE_TYPE, dbo.EVENT_LOGS.IP_ADDRESS, dbo.EVENT_LOGS.CREATE_DATE,dbo.USERS.FIRST_NAME,dbo.USERS.Last_NAMEFROM dbo.EVENT_LOGS INNER JOINdbo.USERS ON dbo.EVENT_LOGS.USER_UID = dbo.USERS.USERID) as TableInfoWhere Row_Count Between ' + @startRowIndex + ' and ' + @maxRowIndex + ' ';Exec(@strSQL);
View 3 Replies
View Related
Oct 5, 1998
Hi SQLGurus,
I have this error isolated in my production environment running SAP/ SQL Server. The options for restoring from database backup
out of question. I tried delete records and dropping the table from SQL Entreprise Manager. when I do DBCC updateusage, it always
encounters this isolated table and stops the DBCC checks. The update statistics and table consistency DBCC checks are running ok.
Table Corrupt: object id does not match between extent in allocation page and Sysindexes; check the following extent: al
loc pg#=4187136 extent#=4187136 object id on extent=12 (object name = sysdepends) object id in Sysindexes=772353966 (ob
ject name = SAPWLSFIDX_OLD) DBCC execution completed. If DBCC printed error messages, see your System Administrator.
I would appreciate any help. Thank you.
View 1 Replies
View Related
Nov 27, 2006
Currently I have the following stored procedure which simply adds a new row in my SQL Express 2005. What I want is that -1). before inserting the record find out the new ID (primary key) value. (ID is automatically a sequential integer generated by SQL Server)2). and set COMPANY_ID = (new) ID Any thoughts? Thanks ALTER PROCEDURE usp_tbl_Company_Insert @Company_ID int, @Name varchar(200), AS<FIND THE NEW ID of the new row in the database> @Company_ID = (new ID) INSERT INTO tbl_Company (Company_ID, Name,)VALUES (@Company_ID, @Name)
View 1 Replies
View Related
Feb 19, 2007
I'd like to pass a multi-value parameter to a stored proc to satisfy an integer field lookup.
example -
CREATE PROC SSRSQuery
@InPublicationId VARCHAR(500) = NULL AS
SELECT * from Table where PublicationId IN (@InPublicationId)
where PublicationId is defined as an int
I've seen various posts on how to split up the input string parameter to use in a string-based lookup but nothing useful for an integer-based lookup.
Any tips or tricks for this?
View 3 Replies
View Related
Nov 6, 2006
Hello All,
Where can I get this drive: Sql server ODBC driver 2000.85.1117.00
Thanks
View 4 Replies
View Related
Jul 31, 2015
How to get the details of a stored proc or sql query which updated a particular table for specified time stamp or interval. Is there any query to get this?
View 3 Replies
View Related
Jul 4, 2000
In SQL Server 7.0 I right click on the database, select Tasks, Select backup, then indicate backup of database (complete) to tape. Overwrite (I put tape into NT Server), OK, then it says backup in progress and then I get the message shown in the subject...
Any advice please? I have backed up NT files on this tape before and have tried a second tape...
Thanks much,
Steve Brown
View 1 Replies
View Related
Dec 1, 2015
During a newly set up on one of our SQL server 2012:
We had enable the trace flags 1117 and 1118 as a good practice using DBCC TRACEON(1117,-1) and similar for 1118.
We have been base lining the server and it came to notice that trace flags are no more enabled.
Property Value CaptureDate
DBCC_TRACESTATUS TF 1117: Status = 1, Global = 1, Session = 0 2015-10-20 00:00:00
DBCC_TRACESTATUS TF 1118: Status = 1, Global = 1, Session = 0 2015-10-20 00:00:00
After reboot:
Property Value CaptureDate
DBCC_TRACESTATUS No trace flags enabled 2015-10-21 00:00:02.340
What can be the reason? What can be done to turn them on permanently, if its actually a good bet in enabling so.
View 5 Replies
View Related
Nov 15, 2006
Hi All
Please review this vb6 code (the stored procedure was added by aspnet_regsql.exe)
Thanks
Guy
With CMD .CommandText = "aspnet_Users_CreateUser" Call .Parameters.Refresh .Parameters(1).Value = "812cb465-c84b-4ac8-12a9-72c676dd1d65" .Parameters(2).Value = "myuser" .Parameters(3).Value = 0 .Parameters(4).Value = Now() Call RS.Open(CMD) End With
The error I get is :Invalid character value for cast specification.
This is the stored procedure code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[aspnet_Users_CreateUser]
@ApplicationId uniqueidentifier,
@UserName nvarchar(256),
@IsUserAnonymous bit,
@LastActivityDate DATETIME,
@UserId uniqueidentifier OUTPUT
AS
BEGIN
IF( @UserId IS NULL )
SELECT @UserId = NEWID()
ELSE
BEGIN
IF( EXISTS( SELECT UserId FROM dbo.aspnet_Users
WHERE @UserId = UserId ) )
RETURN -1
END
INSERT dbo.aspnet_Users (ApplicationId, UserId, UserName, LoweredUserName, IsAnonymous, LastActivityDate)
VALUES (@ApplicationId, @UserId, @UserName, LOWER(@UserName), @IsUserAnonymous, @LastActivityDate)
RETURN 0
END
View 1 Replies
View Related
Dec 10, 2007
I am trying to pass a value from one stored procedure into another. I have got the following stored procedures:
Stored Procedure 1:ALTER PROCEDURE test2
(@Business_Name nvarchar(50)
)
AS
BEGINDECLARE @Client_ID INT
SET NOCOUNT ON;
INSERT INTO client_details(Business_Name) VALUES(@Business_Name) SELECT @Client_ID = scope_identity()
IF @@NESTLEVEL = 1
SET NOCOUNT OFF
RETURN @Client_ID
END
Stored Procedure 2 - Taking Client_ID from the proecedure test2ALTER PROCEDURE dbo.test3
(
@AddressLine1 varchar(MAX),
@Client_ID INT OUTPUT
)
ASDECLARE @NewClient_ID INT
EXEC test2 @Client_ID = @NewClient_ID OUTPUT
INSERT INTO client_premises_address(Client_ID, AddressLine1) VALUES(@Client_ID, @AddressLine1)
SELECT @NewClient_ID
When I run this proecedure I get the following error:
FailedProcedure or function 'test2' expects parameter '@Business_Name', which was not supplied. Cannot insert the value NULL into column 'Client_ID', table 'C:INETPUBWWWROOTSWWEBSITEAPP_DATASOUTHWESTSOLUTIONS.MDF.dbo.client_premises_address'; column does not allow nulls. INSERT fails. The statement has been terminated.
However If I run Stored Procedure Test2 on its own it runs fine
Can anyone help with this issue? Is there something that I have done wrong in my stored procedures?
Also does anyone know If I can use the second stored procedure in a second webpage, but get the value that was created by running the stored proecdure in the previous webpage?
View 9 Replies
View Related
Apr 19, 2004
here is code i have
private void btnGetCustomers_Click(object sender, System.EventArgs e)
{
SqlConnection conn = new SqlConnection ();
conn.ConnectionString = " Data Source=(local); Initial Catalog=Northwind; Integrated Security=SSPI ";
SqlCommand cmd = conn.CreateCommand ();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "procCustomers";
// add the input parameters and set their values
cmd.Parameters.Add(new SqlParameter("@ContactName", SqlDbType.VarChar, 50));
cmd.Parameters["@ContactName"].Value = txbxContactName.Text;
conn.Open ();
SqlDataReader dr = cmd.ExecuteReader ();
if (dr.HasRows == true)
{
dgrdMyDataGrid.DataSource = dr;
dgrdMyDataGrid.DataBind ();
}
else
Response.Write("Nothing found.");
// clean up
dr.Close ();
conn.Close ();
}
and here is the stored procedure:
CREATE PROCEDURE procCustomers
@ContactName nvarchar(50)
AS
SELECT * FROM customers
WHERE customers.contactname LIKE @ContactName
ORDER BY customers.contactname ASC
GO
no compile errors, it just returns nothing even if there is supposed to be a match... what am doing wrong?
View 1 Replies
View Related
Jul 30, 2005
Hi, i encounter a problem in the .NET. I have
write the stored prodeure for the registering function and it works
perfectly in the SQL Server. But when i called the stored procedure
from the .NET, it cannot work. Can someone pls help? Thanks!
Stored Procedure Codes:
CREATE PROCEDURE spAddProfile(@MemNRIC CHAR(9), @MemName
VARCHAR(30), @MemPwd VARCHAR(15), @MemDOB DATETIME, @MemEmail
VARCHAR(80), @MemContact VARCHAR(8))
AS
IF EXISTS(SELECT MemNRIC FROM DasMember WHERE MemEmail = @MemEmail)
--RETURN -200
IF EXISTS(SELECT MemEmail FROM DasMember WHERE MemNRIC = @MemNRIC)
RETURN -201
IF EXISTS(SELECT DATEDIFF(YEAR, @MemDOB, GETDATE())
FROM DasMember
WHERE DATEDIFF(YEAR, @MemDOB, GETDATE()) < 18)
RETURN -202
INSERT INTO DasMember(MemNRIC, MemName, MemPwd, MemDOB, MemEmail,
MemContact, MemDateJoin) VALUES (@MemNRIC, @MemName, @MemPwd, @MemDOB,
@MemEmail, @MemContact, GETDATE())
IF @@ERROR <> 0
RETURN @@ERROR
SET @MemNRIC = @@IDENTITY
RETURN
DECLARE @status int
EXEC @status = spAddProfile 'S1234567J', 'Kim', 'kim', '1986-01-01', 'kim@hotmail.com', '611616161'
SELECT 'Status' = @status
When called from .NET, it cannot works.. These are the codes:
Private Sub btnRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim connStr As String =
System.Configuration.ConfigurationSettings.AppSettings("SqlConnection.connectionString")
Dim dbConn As New SqlConnection
dbConn.ConnectionString = connStr
Try
dbConn.Open()
Dim dbCmd As New SqlCommand
dbCmd.Connection = dbConn
dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.CommandText = "spAddProfile"
Dim dbParam As SqlParameter
dbParam = dbCmd.Parameters.Add("@return", SqlDbType.Int)
dbParam.Direction = ParameterDirection.ReturnValue
dbParam = dbCmd.Parameters.Add("@MemNRIC", SqlDbType.Char, 9)
dbParam.Direction = ParameterDirection.Input
dbParam.Value = txtNRIC.Text
dbParam = dbCmd.Parameters.Add("@MemName", SqlDbType.VarChar, 30)
dbParam.Direction = ParameterDirection.Input
dbParam.Value = txtName.Text
dbParam = dbCmd.Parameters.Add("@MemPwd", SqlDbType.VarChar, 15)
dbParam.Direction = ParameterDirection.Input
dbParam.Value = txtPwd.Text
dbParam = dbCmd.Parameters.Add("@MemDOB", SqlDbType.DateTime)
dbParam.Direction = ParameterDirection.Input
dbParam.Value = txtDOB.Text
dbParam = dbCmd.Parameters.Add("@MemEmail", SqlDbType.VarChar, 80)
dbParam.Direction = ParameterDirection.Input
dbParam.Value = txtEmail.Text
dbParam = dbCmd.Parameters.Add("@MemContact", SqlDbType.VarChar, 8)
dbParam.Direction = ParameterDirection.Input
dbCmd.ExecuteNonQuery()
Dim status As Integer
status = dbCmd.Parameters("@return").Value
If status = -201 Then
lblError.Text = "NRIC already exists!"
ElseIf status = -202 Then
lblError.Text = "You must be at least 18 years to sign up!"
Else
lblError.Text = "Success"
End If
Catch ex As SqlException
lblError.Text = ex.Message
Catch ex As Exception
lblError.Text = ex.message
End Try
End Sub
End Class
Can someone pls help? Thanks a lot!! I appreciated it very much!!
View 7 Replies
View Related
Oct 26, 2000
Hi
When I tried to execute a procedure it give me message:
"Too many arguments were supplied for procedure sp2_ge_ag15_01"
I am doing:
exec sp2_ge_ag11_01 306,'NOVO VELHO',Null,
'1968-04-15','M',90,.17,'novo@com.br','teste'
It has 9 parameters
the begin of the my procedure is:
CREATE procedure dbo.sp2_ge_ag11_01(@Pcd_ficha integer,
@Pnm_ficha varchar(60),
@Pcd_pac integer = null,
@Pdt_nas datetime,
@Psx_pac varchar(01),
@Ppes_pac smallint,
@Palt_pac float,
@Pemail1 varchar(50),
@Pobs varchar(254))
AS
etc...
What Happen
thank you in advance
View 3 Replies
View Related
Sep 14, 2006
Wael writes "Hi all.
i am using SQL server 2000 database and crystal reports XI.
The purpose of this report is to measure the loyalty of the clients to buy and use a prepaid cards from a telephone company, the company concerned to know how it perform on a various range measures.
in technical saying. we have 2 tables (CLL, CRD) the first one save a record about each call made by a certain card, including card no, source no(very important), destination no , date performed, duration and so on ...
the second table contains information about card itself like card no, card price, type , pricing category, time open, date closed (very important), brand, and so on....
as i mentioned there is only 2 fields in concern in our report.
*the first is the source no as an indication of a client (assume that the client will always call from his home to outer line or whatever .... )
*the second is the date closed as it says that a certain card finishes its value at this date, it will be the base date to build your periods on.
the report should do the following:-
1- prompt the user for a period range to analyze.
2- prompt the user to specify how this range will be analyzed (yearly, quarterly, monthly, weekly, ....).
3- cut the range into slices as determined in the second period.
4- for each period, compare it with the previous periods (as whole from the start of the range to just before the current period) to get the following 3 counts:
- new clients : didn't call at the previous period but called in the current period.
- existing clients : called in previous period and still calling in the current period.
- left clients : called in previous period and didn't in the current period .
5- and so on till the last period in the range.
6- this data preferred to be displayed graphically, if not as a crosstab.
7- note that : i said certain client called in a certain period , if he used a card and call at least one time in a that period.
please know that i am a new bie in stored procedures, so if there is a possibility for that report to run with stored procedure, i will be grateful if it is in some details.
at the end , i am so sorry for that detailed explanation, but i want to clarify my poit. please any help, i will appreciate it.
thanks for your time."
View 1 Replies
View Related
Jul 10, 2007
For starters, please feel free to move this if it is in the wrong forum.
The issue I have is this. I have been asked to delete all information from a table that was inserted before May 12 this year. The issue is that when the DB was created, whoever designedd it neglected to add a timestamp column for the user data table (the one I need to purge). Does SQL, by default, happen to store insert times? Would it be something that might hide ina log file somewhere?
View 4 Replies
View Related
Sep 28, 2000
Do anybody aware of any problems with the way that sql 7.0 converting stored procedures from sql 6.5...thanks
View 1 Replies
View Related
Sep 8, 1999
I have a stored procedure that works on my development server but when I placed it on the server that is to be the prodcuction server i get the following response:
output ----------------
The name specified is not recognized as an internal or external command, operable program or batch file.
This is the procedure:
CREATE PROCEDURE sp_OutputClaim @OutFile varchar(255), @CurAns char(8) AS
declare @CmdLine varchar(255)
select FieldX into ##TempTable from Table where FieldY = @CurAns
select @CmdLine = "exec master..xp_cmdshell 'bcp tempdb.dbo.##TempTable out
c:est" + @OutFile + " /Uxx /Pxxx /Sxx /f c:estcp.fmt'"
exec (@CmdLine)
drop table tempdb..##TempTable
Thanks for any help !!!!
Rob
View 1 Replies
View Related
Jul 10, 2007
Hi,
I have written a stored procedure using C#.NET. I deployed it to SQL Server, and everything works fine.
However, an Third-Party app needs to see what parameters it can use for this SP by executing sp_sproc_columns <SP name>
sp_sproc_columns
Seems to work on normal SP's written in T-SQL, but not on Managed SP's. On my SP, sp_sproc_columns does not seem to work. It does not return the parameters. On normal SP's, it does.
Anyone have an idea why this is?
View 1 Replies
View Related
May 6, 2006
Hello
I have restored a SQL 2000 backup of my database, ever since my web applications are unable to use any of the stored procedures.
I get the following error:
Could not find stored procedure 'xxx'.
If I use enterprise manager and go to the procedures tab the procedure appears there.
Any ideas what is up?
PS: The username has been changed, before the backup it was "user1" now its something else. For some reason it still shows that the procedure object is owned by "user1". Could this be the problem?
Thanks in advance.
View 1 Replies
View Related
Jul 22, 2006
Hello, I am trying to make this.
CREATE PROCEDURE [dbo].[P_SEL_ALLPERSONAS]
@nmpersona int,
@sortorder varchar(20)
AS
BEGIN
select nmpersona, dsprimernombre, dssegundonombre,
dsprimerapellido, dssegundoapellido
from personas
order by @sortorder
END
But I got this error. Please help
Msg 1008, Level 16, State 1, Procedure P_SEL_ALLPERSONAS, Line 13
The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.
View 5 Replies
View Related
Mar 13, 2007
Hi,
I am not understanding this part of the problem. I am currently reusing a stored procedure that has a ".." as part of the select statement.
I can't put the select statement up here due to privacy but I have found the error where the error states the following:-
Invalid Column Prefix: AM, invalid table name.
I noticed that part of the select statement was the following:-
AM..Field1
I tried executing this stored procedure in the query analyzer and it works fine, but when I tried executing it in SSRS, it gives me the error. After searching through the internet for possible causes, I found out that it was the ".." was giving the error. Anyone knows why ? I found out that it was supposed to bypass any users and permissions to the table.
Thakns !
Bernard
View 1 Replies
View Related