Error Message 18542 Level 16 State 1
Oct 28, 2005
hi we have a link server....and
the user credentials are not being trasfered to link server.....any
thoughts??
we get the following error message
Server message 18542 level 16 state 1
--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/error-messa...pict266240.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=915273
View 1 Replies
ADVERTISEMENT
Jun 14, 2001
Attempt to fetch logical page ' ' in database ' '. Object belongs to ' ' not object ' '.
Please someone help me fix this. My table is corrupt and I cannot drop it and restore it because I keep getting an error message that says:
Cannot drop table ' ' there is not enough space in syslogs. blah, blah, blah.
Can anyone help me? It woould be much appreciated.
Christine
View 1 Replies
View Related
Dec 17, 2007
I am writing a user defined function but I am receiving an error message that I can figure out. Any answers out there?
Msg 102, Level 15, State 1, Procedure ufn_GetStreetNumber, Line 25
Incorrect syntax near '@StreetNum'.
-- ---------------------------------------------------------------------------------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Description: Parses out the Street number for Address field
-- =============================================
CREATE FUNCTION dbo.ufn_GetStreetNumber
(
-- Add the parameters for the function here
@StreetAddr varchar(50)
)
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @StreetNum varchar(50);
DECLARE @iIter smallint, @iNoOfChars smallint, @iStreetNo int;
SET @StreetNum=NULL;
SET @iStreetNo=0;
SET @iNoOfChars=1;
SET @iIter=1;
-- Add the T-SQL statements to compute the return value here
WHILE Isnumeric(Substring(@StreetAddr,@iNoOfChars,@iIter))=1
@StreetNum=@StreetNum + Substring(@StreetAddr,@iNoOfChars,@iIter)
@iIter=@iIter+1
BREAK
@iStreetNo=@StreetNum
-- Return the result of the function
RETURN @iStreetNo
END
GO
View 3 Replies
View Related
Aug 2, 2007
Hi,
I have built a stored procedure and the code is like below:
Code Snippet
DECLARE @Table_Name VARCHAR(100)
DECLARE @Table_Desc SQL_VARIANT
DECLARE @Query VARCHAR(8000)
USE HRD
SELECT @Table_Name = 'Employee'
SELECT @Query = 'IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N''[dbo].[DEL_' + UPPER(@Table_Name) + ']''))
DROP TRIGGER [dbo].[DEL_' + UPPER(@Table_Name) + ']'
EXEC(@Query)
SELECT @Table_Desc = (SELECT a.value
FROM
sys.extended_properties a, sys.tables b
WHERE a.major_id = b.object_id
AND a.minor_id = 0
AND a.name = 'MS_DESCRIPTION'
AND b.name = @Table_Name)
SELECT @Query = '''CREATE TRIGGER [DEL_' + UPPER(@Table_Name) + '] ON dbo.' + @Table_Name + '
FOR DELETE
AS
DECLARE @Old_Value VARCHAR(8000)
DECLARE @New_Value VARCHAR(8000)
DECLARE @P_Key VARCHAR(8000)
DECLARE @P_Key_Value VARCHAR(8000)
DECLARE @P_Key_Insert VARCHAR(8000)
DECLARE @Comment VARCHAR(8000)
SELECT @P_Key_Insert = ''''''''
EXEC(''''IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''''''[dbo].[Temp_PrimKey]'''''''') AND type in (N''''''''U''''''''))
DROP TABLE [dbo].[Temp_PrimKey]'''')
SELECT K.COLUMN_NAME INTO Temp_PrimKey
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS T
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE K
ON T.CONSTRAINT_NAME = K.CONSTRAINT_NAME
WHERE
T.CONSTRAINT_TYPE = ''''PRIMARY KEY'''' AND T.TABLE_NAME = ''''' + @Table_Name + '''''
EXEC(''''IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''''''[dbo].[Temp_Value]'''''''') AND type in (N''''''''U''''''''))
DROP TABLE [dbo].[Temp_Value]'''')
EXEC(''''CREATE TABLE [dbo].[Temp_Value](
[PValue] [VARCHAR](max) NOT NULL
) ON [PRIMARY]'''')
EXEC(''''IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''''''[dbo].[Temp_Deleted]'''''''') AND type in (N''''''''U''''''''))
DROP TABLE [dbo].[Temp_Deleted]'''')
SELECT * INTO Temp_Deleted FROM deleted
DECLARE Curs_PrimKey CURSOR FOR
SELECT * FROM Temp_PrimKey
OPEN Curs_PrimKey
FETCH NEXT FROM Curs_PrimKey INTO @P_Key
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC(''''INSERT INTO Temp_Value SELECT ''''+ @P_Key + '''' FROM Temp_Deleted'''')
SELECT @P_Key_Value = (SELECT PValue FROM Temp_Value)
EXEC(''''DELETE FROM Temp_Value'''')
SELECT @P_Key_Insert = @P_Key_Insert + @P_Key + '''' = '''' + @P_Key_Value + '''', ''''
FETCH NEXT FROM Curs_PrimKey INTO @P_Key
END
CLOSE Curs_PrimKey
DEALLOCATE Curs_PrimKey
EXEC(''''IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''''''[dbo].[Temp_Deleted]'''''''') AND type in (N''''''''U''''''''))
DROP TABLE [dbo].[Temp_Deleted]'''')
EXEC(''''IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''''''''[dbo].[Temp_Value]'''''''') AND type in (N''''''''U''''''''))
DROP TABLE [dbo].[Temp_Value]'''')
SELECT @P_Key_Insert = LEFT(@P_Key_Insert, LEN(@P_Key_Insert)-2)
SELECT @Comment = ''''' + CAST(@Table_Desc AS VARCHAR) + ' deleted, '''' + @P_Key_Insert
INSERT INTO TLOG(Log_Date, Log_Reference, Log_Comment)
VALUES (GETDATE(), @P_Key_Insert, @Comment)
'''
--PRINT @Query
EXEC(@Query)
Problem is when I run it gives error:
Msg 102, Level 15, State 1, Line 1Incorrect syntax near 'CREATE TRIGGER [DEL_EMPLOYEE] ON dbo.Employee FOR DELETEAS DECLARE @Old_Value VARCHAR(8000)DECLARE @New_Value VARCHA'.
If I print the @Query and run it in a query analyzer using the statement EXEC it worked. It's giving me headache, this supposed to be a simple exec statement. Please advise. Thanks.
View 2 Replies
View Related
Aug 7, 2007
Dear All, I always got this error in CLR TVF:
Msg 6260, Level 16, State 1, Line 1
An error occurred while getting new row from user defined Table Valued Function :
System.InvalidOperationException: Invalid attempt to FieldCount when reader is closed.
System.InvalidOperationException:
at System.Data.SqlClient.SqlDataReaderSmi.get_FieldCount()
at System.Data.Common.DbEnumerator.BuildSchemaInfo()
at System.Data.Common.DbEnumerator.MoveNext()
Here is my code:
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
using System.Collections;
public static class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction(FillRowMethodName = "rowfiller",DataAccess=DataAccessKind.Read,TableDefinition = "ActID int, ActName nvarchar(50), ActCreatorID int,ActDesp nvarchar(200),ActCreateDate datetime,ActModifyDate datetime, ActStartDate datetime, ActEndDate datetime, Status int, Cost int")]
public static IEnumerable Func_GetSchCatActivityIDTable(int CatActivityID)
{
using (SqlConnection connection = new SqlConnection("context connection=true"))
{
string sqlstring = "select * from Activity where CatActivityID=@CatActivityID;";
connection.Open();
SqlCommand command = new SqlCommand(sqlstring, connection);
command.Parameters.AddWithValue("@CatActivityID", CatActivityID);
return command.ExecuteReader(CommandBehavior.CloseConnection);
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft Performance","CA1811:AvoidUncalledPrivateCode")]
public static void rowfiller(Object obj,
out SqlInt32 ActID,
out SqlString ActName,
out SqlInt32 ActCreatorID,
out SqlString ActDesp,
out SqlDateTime ActCreateDate,
out SqlDateTime ActModifyDate,
out SqlDateTime ActStartDate,
out SqlDateTime ActEndDate,
out SqlInt32 Status,
out SqlInt32 Cost,
)
{
SqlDataRecord row = (SqlDataRecord)obj;
int column = 0;
ActID = (row.IsDBNull(column)) ? SqlInt32.Null : new SqlInt32(row.GetInt32(column)); column++;
ActName = (row.IsDBNull(column)) ? SqlString.Null : new SqlString(row.GetString(column)); column++;
ActCreatorID = (row.IsDBNull(column)) ? SqlInt32.Null : new SqlInt32(row.GetInt32(column)); column++;
ActDesp = (row.IsDBNull(column)) ? SqlString.Null : new SqlString(row.GetString(column)); column++;
ActCreateDate = (row.IsDBNull(column)) ? SqlDateTime.Null : new SqlDateTime(row.GetDateTime(column)); column++;
ActModifyDate = (row.IsDBNull(column)) ? SqlDateTime.Null : new SqlDateTime(row.GetDateTime(column)); column++;
ActStartDate = (row.IsDBNull(column)) ? SqlDateTime.Null : new SqlDateTime(row.GetDateTime(column)); column++;
ActEndDate = (row.IsDBNull(column)) ? SqlDateTime.Null : new SqlDateTime(row.GetDateTime(column)); column++;
Status = (row.IsDBNull(column)) ? SqlInt32.Null : new SqlInt32(row.GetInt32(column)); column++;
Cost = (row.IsDBNull(column)) ? SqlInt32.Null : new SqlInt32(row.GetInt32(column)); column++;
}
};
Can anyone tell me what I am doing wrong? Many thanks
.
View 8 Replies
View Related
Feb 19, 2007
we config our SAP system to use SQL Server 2005 database mirror. but the mirror server hang by accident, after restart mirror server,the server return to normal,but the mirror can't be resume.
ALTER DATABASE R3P
SET PARTNER resume
the error is:
Msg 1447, Level 16, State 21, Line 1
ALTER DATABASE "R3P" command cannot be executed until both partner server instances are up, running, and connected. Start the partner and reissue the command.
View 2 Replies
View Related
Oct 16, 2007
Hi all,
In Object Explorer of my ComputerNameSQLEXPRESS, I have a Database "shcDB" with Table "dbo.MyFriends" which has fields "PersonID" (Int), "FirstName", "LastName", "StreetAddress", "City", "State", "ZipCode", "E-MailAddress" set up. When I executed the following query:
/////----shcSP-1.sql---////
USE shcDB
GO
EXEC sp_insertRecord 3, "Mary", "Smith", "789 New St.", "Chicago", "Illinos", "12345", "M_Smith@Yahoo.com"
GO
/////////////////////////////////////////////////////////////
I got the following error message:
Msg 8144, Level 16, State 2, Procure sp_insertRecord, Line 0
Procedure or Function sp_insertRecord has too many arguments specified.
(1) Why did I get this error?
(2) Where can I get the documents for explaining the procedures like 'sp_insertRecord', 'sp_delecteRocord', 'sp_getRecord', 'sp_updateRecord', etc. and error messages?
Please help and give me the answers for the above-mentioned questions.
Thanks in advance,
Scott Chang
P. S.
I used my PC at home to post the above message. I have not been able to post it by using my office PC in our LAN system. In my office LAN system, I have been struggling to figure out and solve the following strange thing: I log in http://forums.microsoft.com and "Sign Out" is on all the time. If I click on "Sign Out", I get "Logout: You have been successfully logged out of the the forums." page all the time. What is the cause to log me out? How can I get it resolved? Our Computer Administrator? Or Microsoft? What Department in Microsoft can help me to solve this problem? Please advise on this strange thing. Thanks.
View 9 Replies
View Related
Nov 3, 2006
I am trying to run the following:
select * from sysindexes
The operation begins and results are produced but after about 200 results, I get the error - Msg 0, Level 11, State 0, Line 0 - and it disconnects.
This is a DB moved (restored) from SQL 2000 to SQL 2005.
Any ideas would be appreciated. I am the "make do" DBA and not very good at it yet, I am afraid.
Regards,
Mike
View 8 Replies
View Related
Sep 7, 2006
Hi chaps,
I have the following SQL query (SQL 2005).
Its basically retrieving some values using simple joins.
However there appears to be a problem with the LEFT OUTER JOIN:
"LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
"
When I try to compile the code i Get :
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "OrderLineItemTransaction.OrderLineItemTransactionI D" could not be bound.
Any help would be appreciated.
Cheers
Bal
SELECT
ord.orderDate,
cc.forename + ' ' + cc.surname person,
prod.description,
oli.noofitems,
deladdr.housenameno + ' ' + deladdr.addressLine1 + ' ' + deladdr.addressLine2 + ' ' + deladdr.city + ' ' + deladdr.postcode + ' ' + deladdr.county + ' ' + deladdr.country deladdress
FROM
product prod,
OrderLineItem oli,
[Order] ord,
OrderTransaction ordT,
OrderLineItemTransaction oliT,
CustomerContact cc,
Customer cust,
DDDispatchedOrder dd,
address deladdr,
address invaddr
LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
WHERE
prod.productID = oli.productID:eek:
AND ord.orderID = oli.orderID
AND ord.orderID = ordT.orderID
AND oliT.orderlineitemID = oli.orderlineitemID
AND cc.customercontactID = ord.customercontactID
AND cc.customerID = cust.customerID
AND ord.invoiceaddressID = invaddr.addressID
AND ord.deliveryaddressID = deladdr.addressID
AND ordT.dispatchTypeID = 2
View 7 Replies
View Related
Nov 2, 2006
Hi,
Does anyone else have this error message pop up in SSMS when you try to parse sql statements:
.Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
There was a thread back in March 2006 that mentioned this error, but the posted resolution was to install SP1. I have SP1 installed but I still get the error.
I only receive the error when I'm parsing statements, if I run the statement it's fine.
Thanks
Matt
View 8 Replies
View Related
Jul 23, 2007
This thing is driving me crazy. I have a simple flat .txt file I'm trying to import into a DB, and this USED to work perfectly with SQL Server 2000. With 2005, I get "product level insufficient."
http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=217596
I've read that and I've looked around. It seems like the solution is to actually connect to the Windows box that the server itself is running on (where SSIS is installed) and import there?? But that's a pain.. that means I'd have to Remote Desktop into the server EVERY time I want to import a text file. Surely there's some other way to do this??
Any advice would be great. Thanks!
View 4 Replies
View Related
Oct 10, 2006
Hi,
I have a SSIS package which I had created on my machine, running Windows XP with SQL2K5 Development Edition. If I run the package through the BI studio or by clicking the dtsx file, it runs without any issues.
When the same package is deployed onto another machine (SBS 2003 with SQL2K5 Workgroup Edition), the package errors with the above message when the dtsx file is clicked and run. However, if the source files are opened up and ran from within the BI studio, it all runs OK.
I've ran through the SQL setup file (through Add/Remove Programs) and Integration Services is installed, however the SSIS service is not on the machine. I've read however that the service is not required to run the package, so what gives? Plus, this doesn't explain why running it through BI studio is fine but not when run by itself.
The data flow task that the package fails on contains 2 SQL sources, 1 SQL destination, 3 sorts, 1 multicast and a couple of merge joins. Are some of these pieces not available in the Workgroup Edition? This would still not explain why it can run in the BI studio on that machine...
Any information provided would be great.
Regards
Alex
View 1 Replies
View Related
Mar 3, 2008
Hello All,
All of a sudden our reports stopped working today giving this error:
Server Error in '/Reports' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Security level already defined for 'RosettaMgr'.
Source Error:
Line 21: <httpRuntime executionTimeout="9000"/>Line 22: <securityPolicy>Line 23: <trustLevel name="RosettaMgr" policyFile="rsmgrpolicy.config"/>Line 24: </securityPolicy>Line 25: <trust level="RosettaMgr" originUrl=""/>
Source File: C:Program FilesMicrosoft SQL ServerMSSQLReporting ServicesReportManagerweb.config Line: 23
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
If I comment out the lines 22 - 25 in the web.config file the reports start to work again, but I am reluctant to do this as I'm not sure what the implications would be if left..
Does anybody have any suggestions??
Many Thanks
View 1 Replies
View Related
Jun 21, 2006
Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below
I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class
2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:
CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]
4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'
5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)
View 13 Replies
View Related
Oct 20, 2007
I am getteing
need help
Query analyzer error Unable to connect server local Msg17, level 16,state 1
ODBC SQL server driver [DBNETLIB]SQL server does not exist
View 6 Replies
View Related
Jun 23, 2000
Server: Msg 229, Level 14, State 5, Procedure sp_monitor, Line 167
EXECUTE permission denied on object 'sp_monitor', database 'master', owner 'dbo'.
How do I fix this? which roles, or permission is that? Is there a
easier way to find out solutions for these problems, as books online
does not seem to provide much help.
Thanks,
Vijay
View 2 Replies
View Related
Apr 26, 1999
Hi,
Running NT 4 Svc Pack 4, SQL Server 6.5 Svc Pack 5a. I have an sp to build indexes and it is no longer running...after a couple moments I get the error(s) "Msg 1509, Lvl20, State 2, Row Compare Error". The "State" is 2 on most of the messages and 1 on 1...I get 5 messages at once. I looked through the support information at Microsoft's site and found 1 article on this but...it was for 6.0, it stated that it was fixed in Svc Pack 3, and provided a workaround of increasing the "sort pages" value in the SQL configuration. I was unable to find the "sort pages" option so I am assuming it is no longer available. I then installed the SQL Svc Pack 5a but still no resolution. At this point I have no indexes on my tables and can't find a way to rebuild them. Any help would be appreciated...The only thing I can think of is that I installed the NT svc pack last week and this might have caused it...the indexes sp runs over the weekend so I did not notice this until this morning.
Thanks in Advance,
Kevin
View 1 Replies
View Related
Feb 1, 2006
Hi,I am getting the following error from the query below against SQLServer 8.00.2039 (SP4)Error:====Server: Msg 107, Level 16, State 2, Line 1The column prefix 'd' does not match with a table name or alias nameused in the query.Select Statement:=============select ....from trades a,gems_product_groups b,portfolio_nav_mapping c,products d,limit_types eleft outer join gems_prod_trade_mod f on d.product_id =f.product_IDI know this was a known bug in MS-SQL7, but I thought it had been fixedin 2000.Can anyone help?Thanks
View 3 Replies
View Related
May 13, 2008
IN THE SQL SERVER 2000 AND IN ALSO IN 2005 WHEN GOING FOR THE LOGGING IN TO THE SQL SERVER USING A PUBLIC IP, AND GIVING THE SQL SERVER AUTENTICATION IT IS GIVING THE FOLLOWING ERROR
Server: Msg 11, Level 16, State 1[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network error. Check your network documentation.
THE SAME ISSUE HAPPENING WITH THE ODBC CONNECTION. CAN ANYONE EXPLAIN ME WITH THE FOLLOWING ERROR
DO NOT GIVE A SUGGESTION OF REINSTALLATION, BECAUSE TRIED THAT ONE TOO
REGARDS
CHAITANYA BABU YANAMADALA
View 2 Replies
View Related
Jun 7, 2005
Simple SQL Error Can anyone help for a new starter. Error MessageServer: Msg 209, Level 16, State 1, Line 6 Ambiguous column name 'CustomerID'.Codeselect CustomerID, ContactName, OrderId from CustomersInner Join Orders OnCustomers.CustomerID = Orders.CustomerIDDBMS = SQL Server 2000 SP 3aDatabase = NorthwindI have no idea why i receive this error
View 1 Replies
View Related
Mar 16, 2001
Hi, I would appreciate your help. I donot know why I am getting this error when I run this query :
if (select SUBSTRING(de_ftpdownload,1,CHARINDEX('.',de_ftpdow nload,0)-1)as de_ftpdownload from vendor_invoice)
<> (select stamp_number from vendor_invoice)
select 'no'
else
select 'yes'
I get this Error
Server: Msg 536, Level 16, State 3, Line 1
Invalid length parameter passed to the substring function.
----
yes
(1 row(s) affected)
I would appreciate your hlep
Al
View 1 Replies
View Related
Jun 23, 2004
Can anybody help me with this syntax?
select
PHN.N_PHN_ID 'ID',
PHN.N_PHN_AREACD 'AREAD1',
PHN.N_PHN_PREFIX 'PREFIXD1',
PHN.N_PHN_NUMBER 'NBRD1',
PHN.N_PHN_EXTENTN 'EXTD1',
PHN2.N_PHN_AREACD 'AREAD2',
PHN2.N_PHN_PREFIX 'PREFIXD2',
PHN2.N_PHN_NUMBER 'NBRD2',
PHN2.N_PHN_EXTENTN 'EXTD2'
from Donor_Visit2 DV2 RIGHT OUTER JOIN NAT_PHN_DB_REC PHN
ON DV2.COUNT_INSTID = PHN.N_PHN_INSTID
RIGHT OUTER JOIN NAT_PHN_DB_REC PHN2
ON DV2.COUNT_ID = PHN2.PHN.N_PHN_ID
order by PHN.N_PHN_ID
here is the error message:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'PHN2.PHN' does not match with a table name or alias name used in the query.
View 1 Replies
View Related
Nov 22, 2004
Hello All,
This table was created by coldfusion and has been given all priviliges to public and I am in the public group but I still cant select from it. It gives me this error message: Server: Msg 208, Level 16, State 1, Line 1. Help!
Thanks in Advance.
View 5 Replies
View Related
Feb 15, 2008
I'm getting this error in SQL server.
Msg 8101, Level 16, State 1, Line 68
An explicit value for the identity column in table 'temp_notes' can only be specified when a column list is used and IDENTITY_INSERT is ON.
My original script looked like this.
SET NOCOUNT ON
DECLARE @patient_id int
,@phn varchar(9)
,@full_name varchar(100)
,@birth_date datetime
,@entry_note varchar(8000)
,@entry_date datetime
,@rec_counter int
,@Clinic_identifier varchar(24)
,@chart_count int
set @Clinic_identifier = 'MEDOWL.'
set @rec_counter = 0
DECLARE patients_cursor CURSOR FOR
SELECT a.full_name, a.birth_date, a.phn, a.patient_id
FROM patient as a
,clinicdoctors as b
WHERE a.patient_id IN (51450,49741,57290) --= 51450
and datalength(a.phn) = 9
and b.clinicdoctor_id = a.clinicdoctor_id
ORDER BY a.last_name,a.first_name,a.patient_id
OPEN patients_cursor
FETCH NEXT FROM patients_cursor
INTO @full_name, @birth_date, @phn, @patient_id
--select @full_name, @birth_date, @phn, @patient_id
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE chartcount_cursor CURSOR FOR
select count(*)
from ChartEntries
where patient_id = @patient_id
OPEN chartcount_cursor
FETCH NEXT FROM chartcount_cursor INTO @chart_count
--select @chart_count as chtcount
DECLARE chartentries_cursor CURSOR FOR
select entry_datetime,entry_note
from ChartEntries
where patient_id = @patient_id
order by Patient_id, ChartEntry_Id desc
-- Variable value from the outer cursor
OPEN chartentries_cursor
FETCH NEXT FROM chartentries_cursor INTO @entry_date,@entry_note
--select @entry_date,@entry_note
WHILE @@FETCH_STATUS = 0
BEGIN
set @rec_counter = @rec_counter + 1
--select @@FETCH_STATUS as status
IF @@FETCH_STATUS = 0
insert into temp_notes
values (@Clinic_identifier+@phn+'.'
+convert(varchar,@rec_counter)+'.'
+convert(varchar,@chart_count),
@phn,
@full_name,
@birth_date,
@entry_date,
@entry_note
)
-- Get the next entry note
FETCH NEXT FROM chartentries_cursor INTO @entry_date,@entry_note
--select @entry_date,@entry_note
END
CLOSE chartentries_cursor
DEALLOCATE chartentries_cursor
CLOSE chartcount_cursor
DEALLOCATE chartcount_cursor
set @rec_counter = 0
set @chart_count = 0
-- Get the next patient record
FETCH NEXT FROM patients_cursor
INTO @full_name, @birth_date, @phn, @patient_id
--select @full_name, @birth_date, @phn, @patient_id
-- Get the next chart record count
--FETCH NEXT FROM chartcount_cursor INTO @chart_count
--select @chart_count as chtcount
END
CLOSE patients_cursor
DEALLOCATE patients_cursor
GO
I then changed it to left pad the variables @rec_counter and @chart_count.
SET NOCOUNT ON
DECLARE @patient_id int
,@phn varchar(9)
,@full_name varchar(100)
,@birth_date datetime
,@entry_note varchar(8000)
,@entry_date datetime
,@rec_counter int
,@Clinic_identifier varchar(24)
,@chart_count int
set @Clinic_identifier = 'MEDOWL.'
set @rec_counter = 0
DECLARE patients_cursor CURSOR FOR
SELECT a.full_name, a.birth_date, a.phn, a.patient_id
FROM patient as a
,clinicdoctors as b
WHERE a.patient_id IN (51450,49741,57290) --= 51450
and datalength(a.phn) = 9
and b.clinicdoctor_id = a.clinicdoctor_id
ORDER BY a.last_name,a.first_name,a.patient_id
OPEN patients_cursor
FETCH NEXT FROM patients_cursor
INTO @full_name, @birth_date, @phn, @patient_id
--select @full_name, @birth_date, @phn, @patient_id
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE chartcount_cursor CURSOR FOR
select count(*)
from ChartEntries
where patient_id = @patient_id
OPEN chartcount_cursor
FETCH NEXT FROM chartcount_cursor INTO @chart_count
--select @chart_count as chtcount
DECLARE chartentries_cursor CURSOR FOR
select entry_datetime,entry_note
from ChartEntries
where patient_id = @patient_id
order by Patient_id, ChartEntry_Id desc
-- Variable value from the outer cursor
OPEN chartentries_cursor
FETCH NEXT FROM chartentries_cursor INTO @entry_date,@entry_note
--select @entry_date,@entry_note
WHILE @@FETCH_STATUS = 0
BEGIN
set @rec_counter = @rec_counter + 1
--select @@FETCH_STATUS as status
IF @@FETCH_STATUS = 0
insert into temp_notes
values (@Clinic_identifier+@phn+'.'
+REPLICATE('0',3),convert(varchar,@rec_counter)+'. '
+REPLICATE('0',3),convert(varchar,@chart_count),
@phn,
@full_name,
@birth_date,
@entry_date,
@entry_note
)
-- Get the next entry note
FETCH NEXT FROM chartentries_cursor INTO @entry_date,@entry_note
--select @entry_date,@entry_note
END
CLOSE chartentries_cursor
DEALLOCATE chartentries_cursor
CLOSE chartcount_cursor
DEALLOCATE chartcount_cursor
set @rec_counter = 0
set @chart_count = 0
-- Get the next patient record
FETCH NEXT FROM patients_cursor
INTO @full_name, @birth_date, @phn, @patient_id
--select @full_name, @birth_date, @phn, @patient_id
-- Get the next chart record count
--FETCH NEXT FROM chartcount_cursor INTO @chart_count
--select @chart_count as chtcount
END
CLOSE patients_cursor
DEALLOCATE patients_cursor
GO
That is when I received the error, so I inserted this command before the insert line but it made no difference.
SET IDENTITY_INSERT temp_notes ON
insert into temp_notes
values (@Clinic_identifier+@phn+'.'
+REPLICATE('0',3),convert(varchar,@rec_counter)+'. '
+REPLICATE('0',3),convert(varchar,@chart_count),
@phn,
@full_name,
@birth_date,
@entry_date,
@entry_note
)
I'm concatenating four different variables together to insert into the column note_id.
What is the problem? I just don't see it. My table definition looks like this.
CREATE TABLE [dbo].[temp_notes](
[temp_Id] [int] IDENTITY(1,1) NOT NULL,
[note_Id] [varchar](24) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[phn] [char](9) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[full_name] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[birth_date] [datetime] NULL,
[entry_datetime] [datetime] NULL,
[Entry_Note] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_temp_notes] PRIMARY KEY CLUSTERED
(
[temp_Id] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
View 2 Replies
View Related
Dec 4, 2007
Error 4305
What would be the cause of this error?
Msg 4305, Level 16, State 1, Line 1
The log in this backup set begins at LSN 8229000000047200001, which is too recent to apply to the database. An earlier log backup that includes LSN 8219000000021400001 can be restored
And what would the fix be?
I am trying to restore from a Full Backup and then the log files on a development machine.
Cheers,
Casey
View 5 Replies
View Related
Jul 18, 2007
Hi All,
I am facing a very strange problem in one of my SQL2000 instance.
Actually, In one of my 2000 instance 'A', I have linked another 2000 instance 'B' (server 'B' is running under windows authentication) and I am a member of a group (SQL_Group) and that group is listed in sysadmin of both 'A' and 'B' Instances. When I am trying to run a simple select query from server 'A' to linked server 'B'
i.e. select top 2 * from [<Server_Name> <Instance_ Name>].master. dbo.sysobjects
It is giving me an error.
Server: Msg 18452, Level 14, State 1, Line 1
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
But rest of the members of same group (SQL_Group) are able to execute this query. Can anyone please let me know why this issue is only for me even I am having the same permissions as others??
Any help will be highly appreciated. thanks a lot to all of you.
Rizwan...........
View 2 Replies
View Related
May 1, 2008
need help
on expression IN
whan i do this i get an error
Msg 207, Level 16, State 1, Line 17
Invalid column name 't.empID'.
Code Snippet
DECLARE @vempID varchar(500)
set @vempID = '68737477,51622017'
update [nili].[dbo].[tb_pivot_big]
set fld1 = case v.fld1 when '101' then 'a' when '102' then 'd' when '103' then 'u' when '104' then 'j' end
, f1 = case v.fld1 when '101' then 'b' when '102' then 'r' when '103' then 'i' when '104' then 'l' end
, f11 = case v.fld1 when '101' then 'c' when '102' then 't' when '103' then 'd' when '104' then 'm' end
from [nili].[dbo].[tb_pivot_big] t
inner join (select *
from [nili].[dbo].[tb_pivot_big]
where val_orginal = 1) v
on t.empID = v.empID
WHERE (t.val_orginal = 2) AND (charindex(','+CONVERT(varchar,[t.empID])+',',','+@vempID+',')) > 0
whan i run it like this it OK
Code Snippet
SELECT v.Fname, v.empID
FROM dbo.tb_pivot_big AS t INNER JOIN
(SELECT napipot, Fname, empID, new_unit, mhlka_id, mhlka, val_orginal, fld1, f1, f11, fld2, f2, f22, fld3, f3, f33, fld4, f4, f44, fld5, f5, f55, fld6, f6, f66, fld7, f7, f77,
fld8, f8, f88, fld9, f9, f99, fld10, f10, f110, fld11, f_11, f111, fld12, f12, f112, fld13, f13, f113, fld14, f14, f114, fld15, f15, f115, fld16, f16, f116, fld17, f_7,
f117, fld18, f18, f118, fld19, f19, f119, fld20, f20, f220, fld21, f21, f221, fld22, f_22, f222, fld23, f23, f223, fld24, f24, f224, fld25, f25, f225, fld26, f26, f226,
fld27, f27, f227, fld28, f28, f228, fld29, f29, f229, fld30, f30, f330, fld31, f31, f331
FROM dbo.tb_pivot_big
WHERE (val_orginal = 1)) AS v ON t.empID = v.empID
WHERE (t.val_orginal = 2) AND (t.empID IN (68737477, 51622017))
TNX
View 1 Replies
View Related
Jul 19, 2006
Hello Folks,
I am moving the model & Msdb databases to a different location and I have this error.
Thanks
Msg 3710, Level 16, State 1, Line 1
Cannot detach an opened database when the server is in minimally configured mode.
View 3 Replies
View Related
Jan 25, 2002
If we run the query below with the values of 'rml' and 'ra' it runs but if we use 'cca' and 'cc' we get this error:
Server: Msg 1101, Level 17, State 10, Line 8
Could not allocate new page for database 'TEMPDB'. There are no more pages available in filegroup DEFAULT. Space can be created by dropping objects, adding additional files, or allowing file growth.
Here is the query
Declare @Level_1 varchar(3),
@Level_2 varchar(2)
Select @Level_1 = 'cca'
Select @Level_2 = 'cc'
select distinct tblAsset.State, tblAsset.County, tblAsset.Plant, tblAsset.Account,
tblAsset.Acq_Yr, tblAsset.Acq_Pd, tblAsset_Book.Cost_Original,
tblCounty_Names.County_Name, CER..tblLocation.Location,
tblGL_Account.Account_Desc
from tblAsset, tblAsset_Book, tblCounty_Names, CER..tblLocation, tblGL_Account
where tblAsset_Book.Level_1 = @Level_1
and tblAsset.Level_1 = tblAsset_Book.Level_1
and tblAsset_Book.Level_2 = @Level_2
and tblAsset.Level_2 = tblAsset_Book.Level_2
and tblGL_Account.Company = tblAsset.Level_2
and CER..tblLocation.SBU = tblGL_Account.Company
and tblCounty_Names.County = tblAsset.County
and CER..tblLocation.County = tblCounty_Names.County
and CER..tblLocation.Code = tblAsset.Plant
and tblGL_Account.Account = tblAsset.Account
and tblAsset_Book.Book_Number = '1'
order by tblAsset.State
View 1 Replies
View Related
Jan 5, 2001
When I try to update one table from another I get the following error
message, Does anyone know what may be the cause of the error :
Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.
Thanks
KUL
View 2 Replies
View Related
Oct 24, 2005
Server:Msg 1105,Level 17,State 2,Line9
Coule not allocate space to the object 'Tutorial' on 'Mytest1db'
in database because the 'PRIMARY' file group is full.
When I run a query to insert records into a table....i'm getting this error.Please Help....
View 2 Replies
View Related
Feb 9, 2006
Dear All participants.
My distribution log file size is reached upto 33GB, What I should do?
Any clue or helps are too appreciable.
Thanks
R.Mall
View 3 Replies
View Related
Aug 25, 2007
i have sp4 install. Anyone know how to fix it?
Server: Msg 2537, Level 16, State 43, Line 1
Table error: Object ID 1376776012, index ID 0, page (1:56868), row 2. Record check (Valid SqlVariant) failed. Values are 7 and 0.
Server: Msg 2537, Level 16, State 1, Line 1 ... so on
=============================
http://www.sqlserverstudy.com
View 9 Replies
View Related