How Do I Insert CR/LF - CHAR(13) Does Not Work

Jun 25, 2004

I need to send some long emails, problem is when I send a long body text CDO breaks up the message with spaces in the middle of words. I read on this forum the solution would be to insert CR/LF into the message so that CDO would not have to break it up at every 1k of text. I have tried using CHAR(13) as BOL suggests, but this is not doing as intended, it inserts a space and not the CR/LF I need.

Any suggestions how to insert CR/LF or why my installation is not responding to CHAR(13) is there some other escape code I could use?

View 3 Replies


ADVERTISEMENT

Any Work Around For 4000 Char Maximum Limitation In Expression

Jul 6, 2007

Hello,



I have to build dynamic sql statement in an SQL task.

The SQL statement is way over 4000 char.

The expression builder complains the length of the expression.



Any work around to this limitation?



Thanks a lot!

View 4 Replies View Related

Can't Insert Dt_str To Char Type

Dec 18, 2007

Hi,

Having problem with OLE-DB connection to informix.

Created a flat file has two columns and 2 row:
1|a
2|b

tried to load it to a informix table:
create table t
( c1 int,
c2 char
);

2 rows inserted, but only column c1 got data.

Changed c2 from char to varchar then ok.

thanks for any help.

gg

View 17 Replies View Related

How To Insert NULL Char Values In SQLSERVER With A SQL Sentence?

Jul 20, 2005

Hi everyone!I am working with Delphi v7 and MS SQLServer.I am trying to insert data in a table with a SQL sentence. Some of thefields of my table are type char or varchar, and they can have nullvalues.¿What do i have to write in the SQL sentence to insert a null value inthose fields?I tried with '', an empty String, but it doesnt work, the tablesstores an empty String (logical :-)).In the SQLServer GUI you have to press CTRL + 0 to insert a NULLvalue, but how can i tell this to the SQLServer through a SQLSentence?Well, thank you very much.

View 2 Replies View Related

Should This Insert Work?

May 17, 2006

the 1st insertcommand works but the 2nd one does not. Shouldn't I be able to substitute a var in the parameter's place?
Dim zid As String = Session("ID")
SqlDataSource2.InsertCommand = "insert into cart (lmca_nbr,office,noun, price, quantity) values (?,?,?,?,?)"
SqlDataSource2.InsertCommand = "insert into cart (lmca_nbr,office,noun, price, quantity) values (zid,?,?,?,?)"
SqlDataSource2.Insert()

View 8 Replies View Related

How To Substring From 12 Char To 8 Char Itemid

Jun 19, 2008

Hi,


alter PROCEDURE [dbo].[PPUpdateIWDetails]

(
@CompanyID NVARCHAR(36),
@DivisionID NVARCHAR(36),
@DepartmentID NVARCHAR(36),
@ItemID NVARCHAR(36),
@OrderNo NVARCHAR(36),
@LineNo NVARCHAR(36),
@TAllotedQty Numeric,
@EmployeeID NVARCHAR(36),
@Trndate datetime
)
AS
BEGIN
By default iam passing 12 char itemid as parameter...

Here iam selecting the itemid from InventoryLedger -if it is 8 char than this query should be executed
IF EXISTS(SELECT ItemID FROM InventoryLedger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID)

BEGIN
DECLARE @Qty INT

select @Qty =QUANTITY from inventoryledger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID
select qtyonhand=qtyonhand+@Qty from InventoryByWareHouse where ItemID=@ItemID
END

Here iam selecting the itemid from InventoryLedger -if it is 12 char than this query should be executed(both queries are same)
IF EXISTS(SELECT ItemID FROM InventoryLedger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID)

BEGIN
DECLARE @Qty INT

select @Qty =QUANTITY from inventoryledger WHERE TransDate=@Trndate AND ItemID=@ItemID AND ILLineNumber =@LineNo AND TransNumber=@OrderNo AND TransactionType='Production' AND CompanyID=@CompanyID AND DivisionID= @DivisionID AND DepartmentID=@DepartmentID
select qtyonhand=qtyonhand+@Qty from InventoryByWareHouse where ItemID=@ItemID
END

View 11 Replies View Related

Need Help Trying To Work With Forms Control To Update, Insert, And Etc...

Aug 14, 2007

Hello,
I am trying to use the forms view control to do a simple web app. My issue is, I cant get the connection to automatically generate insert, update and delete statements. I tried to do this manually but I always get an error. I have read that I need all the keys selected--this still didnt work.  I have about 6 tables picked in my view, and if I pick one of them then this advanced feature works. I have the primary keys selected.
 here is my saved view. this is in SQL 2000.
SELECT     TOP 100 PERCENT dbo.ADDRESS.EMAIL, dbo.ADDRESS.FIRST_NAME AS [first name], dbo.ADDRESS.LAST_NAME AS [last name],                       dbo.ADDRESS.STATE, dbo.ADDRESS.TEL1 AS phone, dbo.INVOICES.QUOTE_NO AS [SALES QUOTE], dbo.CUST.NAME AS Company,                       dbo.ITEMS.ITEMNO AS [Course Number], dbo.ITEMS.DESCRIPT AS S_Descript, dbo.ADDRESS.JOB_TITLE AS [Job Title],                       dbo.TRAINING_SCHEDULE.[MONTH], dbo.TRAINING_SCHEDULE.S_DATE, dbo.TRAINING_SCHEDULE.END_DATE,                       dbo.TRAINING_SCHEDULE.IS_CONFIRMED, dbo.TRAINING_SCHEDULE.IS_PAID, dbo.TRAINING_SCHEDULE.CUST_CODE AS Account,                       dbo.TRAINING_SCHEDULE.SCHEDULE_ID, dbo.CUST.CUST_CODE, dbo.INVOICES.INVOICES_ID, dbo.X_INVOIC.X_INVOICE_ID,                       dbo.ADDRESS.ADDR_CODEFROM         dbo.TRAINING_SCHEDULE INNER JOIN                      dbo.CUST ON dbo.TRAINING_SCHEDULE.CUST_CODE = dbo.CUST.CUST_CODE RIGHT OUTER JOIN                      dbo.X_INVOIC RIGHT OUTER JOIN                      dbo.INVOICES ON dbo.X_INVOIC.ORDER_NO = dbo.INVOICES.DOC_NO LEFT OUTER JOIN                      dbo.ADDRESS ON dbo.INVOICES.CUST_CODE = dbo.ADDRESS.CUST_CODE LEFT OUTER JOIN                      dbo.ITEMS ON dbo.ITEMS.ITEMNO = dbo.X_INVOIC.ITEM_CODE ON dbo.CUST.CUST_CODE = dbo.ADDRESS.CUST_CODEWHERE     (dbo.X_INVOIC.ITEM_CODE LIKE 'FOT-%') AND (dbo.X_INVOIC.STATUS = 7) AND (dbo.ADDRESS.TYPE IN (4, 5, 6)) AND (dbo.ADDRESS.EMAIL <> '') AND                       (dbo.ADDRESS.COUNTRY = 'UNITED STATES') AND (dbo.ITEMS.CATEGORY = 'TRAININGCLASSES') AND                       (dbo.TRAINING_SCHEDULE.CUST_CODE = 'joe')ORDER BY dbo.ADDRESS.STATE
I am new to this so I am not sure what to include.
thanks,
yellier

View 1 Replies View Related

Simple Insert From Querystring Doesn't Work - Why?

Apr 13, 2006

I want to insert values from the querystring but nothing happens with this code (the sp works great from the Query Analyzer):
 
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"InsertCommand="spSearch_row_insert" InsertCommandType="StoredProcedure">
<InsertParameters>
<asp:QueryStringParameter Name="CustomerID" QueryStringField="1" DefaultValue="1" Type="String" />
<asp:QueryStringParameter Name="SearchID" QueryStringField="2" DefaultValue="1" Type="String"/>
<asp:QueryStringParameter Name="SearchDate" QueryStringField="3" DefaultValue="1" Type="String" />
<asp:QueryStringParameter Name="IP" QueryStringField="4" DefaultValue="1" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
 
I'm very grateful for help!// G

View 3 Replies View Related

Minimal Permission For Identity Insert On To Work

Jun 12, 2014

We are using sqlserver2005 at our liveserver. Due to some third party attacks which caused loss of data, we changed the sql user permission to only read,write and execute. Now, some of the sps in the db contain code to insert into identity column with line

SET IDENTITY_INSERT [tblName] ON
insert stmts...
SET IDENTITY_INSERT [tblName] OFF

This throwing error as

Cannot find the object "tblName" because it does not exist or you do not have permissions.

Which minimal permission can be given to get the above code work with identity insert on/off? We have removed the dbo permission due to external attacks.

View 2 Replies View Related

Updating A Column With Scope_Identity After An Insert Sometimes Does Not Work

Jan 21, 2008



Hello,

I have the following stored procedure that inserts records and updates the new record. The parameter @rpt_id has a value of -1 when entering the procedure. It needs to be updated with the new record if (identity) once the record is inserted, bu sometimes the update does not happen. The new records ends up with -1 in the rpt_id column.

I have included the stored procedure. I will appreciate any ideas?


ALTER PROCEDURE [dbo].[thhill_InsertReport]

(

@RPT_ID int,

@REPORT_DATE datetime,

@COMMIT_DATE datetime,

@JOB_NUMBER nvarchar(50),

@TECH_NAME nvarchar(75),

@CLIENT_NAME nvarchar(255),

@CLIENT_CONTACT nvarchar(75),

@CITY nvarchar(75),

@STATE nvarchar(75),

@COUNTRY nvarchar(75),

@SUPPLIER nvarchar(75),

@WORK_ORDER nvarchar(75),

@RIG_NAME nvarchar(75),

@WELL_NAME nvarchar(75),

@OCSG_NUMBER nvarchar(75),

@AFE_NUMBER nvarchar(75),

@MGMT varchar(6000),

@Complete varchar(3),

@newReportId int output,

@changeCommitDate bit = 1

)

AS

SET NOCOUNT ON;

if @changeCommitDate = 1

set @COMMIT_DATE = getdate()

INSERT INTO [reports] ([RPT_ID], [REPORT_DATE], [COMMIT_DATE], [JOB_NUMBER], [TECH_NAME], [CLIENT_NAME], [CLIENT_CONTACT], [CITY], [STATE], [COUNTRY], [SUPPLIER], [WORK_ORDER], [RIG_NAME], [WELL_NAME], [OCSG_NUMBER], [AFE_NUMBER], [MGMT], [isReportComplete])

VALUES (@RPT_ID, @REPORT_DATE, @COMMIT_DATE, @JOB_NUMBER, @TECH_NAME, @CLIENT_NAME, @CLIENT_CONTACT, @CITY, @STATE, @COUNTRY, @SUPPLIER, @WORK_ORDER, @RIG_NAME, @WELL_NAME, @OCSG_NUMBER, @AFE_NUMBER, @MGMT, @Complete );

declare @reference int, @tmpReportId int

set @tmpReportId = SCOPE_IDENTITY()

set @reference = @tmpReportId * -1


SET NOCOUNT Off;


Update [reports] set [RPT_ID] = @reference where id = @tmpReportId

select @newReportId = RPT_ID

FROM REPORTS

WHERE (ID = @tmpReportId)

View 3 Replies View Related

Enable Identity Insert Doesn't Work

Jan 4, 2008

Hi,

I'm trying to transfer data between two 2005 databases using the import/export method. I set the Enable Identity insert to true - edit mappings option - on all the tables but I still get the ID set back to 1. I want to add some live data to an altered database structure, and I'm assuming the import/export tool is the way to do this.

I'm using sql server management studio, SP1

Thanks, this is becoming really frustrating.

Peter Cat

View 6 Replies View Related

Simple Lab For Insert/retrive BLOB Doesn't Work, Why Not?

Sep 17, 2007



This is simple enough and I'm stumped. Why doesn't this work?




Code Snippet
use w
go
-- Create image warehouse
create table dbo.ImageWarehouse (
[ImageWarehouseID] int identity(1,1) primary key,
[ImageName] varchar(100),
Photo varbinary(max))
Go
-- Import image
Insert into dbo.ImageWarehouse
([ImageName]) values ('testingimage.gif')
update dbo.ImageWarehouse
set Photo =
(SELECT * FROM OPENROWSET(BULK 'c: estingimage.gif', SINGLE_BLOB)AS x )
WHERE [ImageName]='testingimage.jpg'
go
-- Check population
--delete from dbo.ImageWarehouse
select * from dbo.ImageWarehouse
go
-- Export image
declare @SQLcommand nvarchar(4000)
set @SQLcommand = 'bcp "SELECT top 1 Photo FROM w.dbo.ImageWarehouse WHERE ImageName = ''testingimage.gif''" queryout "c: estingimage_out.gif" -T -N -S [my server name]'
exec xp_cmdshell @SQLcommand
go





I successfully see




Code SnippetImageWarehouseID ImageName Photo
1 testingimage.gif 0x4749463839615802C (long hex string)



then




Code Snippet
output
NULL
Starting copy...
NULL
1 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1
NULL






But testingimage_out.gif is unreadable. It's the same size (28k) as the original trestingimage.gif. Same result with a .jpg file. Try to open the file and it's just red X.

No SQL errors. Just result error. What am I overlooking?




View 4 Replies View Related

SQL CE 3.5, VS 2008 Beta2: Could Not Get A Simple INSERT Command To Work!

Sep 13, 2007

Hello,

I have installed VS 2008 Beta 2 which includes SQL CE 3.5, (I have VS 2005 installed too).

I can not get any INSERT command to work!

First i have tried the VS wizard for a new connection and a dataset. but after inserting a row into one of the dataset tables and then updating it to SQL CE with tha data adapter, nothing happens! NO ERROR and NO inserted row in the database file! so the identity of the inserted row in dataset table doesnt get updated.

Then i tried a simple code without any dataset in a clean solution:





Code Snippet

Dim con As New SqlCeConnection("Data Source=|DataDirectory|MyDatabase#1.sdf")
Dim cmd As New SqlCeCommand("INSERT INTO [Table1](Name) VALUES('TestValue')", con)
Try
con.Open()
cmd.ExecuteNonQuery()
Catch ex As SqlCeException
MessageBox.Show(ex.Message)
Finally
con.Close()
End Try
NO ERROR! NO INSERTED ROW! Nothing happen!

I'm using it in a desktop application.

Why?

Regards,
Parham.

View 5 Replies View Related

How Can I Insert Date Values From Char Values

Jan 4, 1999

My process return a date in char format like "3/12/1998",
How could I put this data ( in char ) directly to date ISQ Server field ?

Thank's

View 1 Replies View Related

SQL Server Insert Update Stored Procedure - Does Not Work The Same Way From Code Behind

Mar 13, 2007

All:
 I have created a stored procedure on SQL server that does an Insert else Update to a table. The SP starts be doing "IF NOT EXISTS" check at the top to determine if it should be an insert or an update.
When i run the stored procedure directly on SQL server (Query Analyzer) it works fine. It updates when I pass in an existing ID#, and does an insert when I pass in a NULL to the ID#.
When i run the exact same logic from my aspx.vb code it keeps inserting the data everytime! I have debugged the code several times and all the parameters are getting passed in as they should be? Can anyone help, or have any ideas what could be happening?
Here is the basic shell of my SP:
CREATE PROCEDURE [dbo].[spHeader_InsertUpdate]
@FID  int = null OUTPUT,@FLD1 varchar(50),@FLD2 smalldatetime,@FLD3 smalldatetime,@FLD4 smalldatetime
AS
Declare @rtncode int
IF NOT EXISTS(select * from HeaderTable where FormID=@FID)
 Begin  begin transaction
   --Insert record   Insert into HeaderTable (FLD1, FLD2, FLD3, FLD4)    Values (@FLD1, @FLD2, @FLD3,@FLD4)   SET @FID = SCOPE_IDENTITY();      --Check for error   if @@error <> 0    begin     rollback transaction     select @rtncode = 0     return @rtncode    end   else    begin     commit transaction     select @rtncode = 1     return @rtncode    end      endELSE
 Begin  begin transaction
   --Update record   Update HeaderTable SET FLD2=@FLD2, FLD3=@FLD3, FLD4=@FLD4    where FormID=@FID;
   --Check for error   if @@error <> 0    begin     rollback transaction     select @rtncode = 0     return @rtncode    end   else    begin     commit transaction     select @rtncode = 2     return @rtncode   end
End---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 Thanks,
Blue.

View 5 Replies View Related

JDBC: PreparedStatement#getParameterMetaData() Doesn't Work For INSERT SQL Query

Feb 26, 2008

Hi,

I'm using MSSQL 2005 JDBC driver version 1.2 with MSSQL Server 2005. Getting parameter's metadata doesn't seem to be working properly there. PreparedStatement#getParameterMetaData() works fine if PreparedStatement is created for some SELECT but fails for any INSERT statements. The same code works fine with other DBs (I checked with HSQLdb and PostgreSQL). See sample below

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbcqlserver://mssql2005\mssql2005;DatabaseName=alexdtms;user=xxx;password=xxx";

// I don't care about non-closed statements, it's just sample code
Connection con = DriverManager.getConnection(connectionUrl);
con.createStatement().executeUpdate("CREATE Table Table1 (RECORD_ID varchar, TgtQty float)");
PreparedStatement ps = con.prepareStatement("INSERT INTO Table1 VALUES ( ?,? )");

ParameterMetaData pmd = ps.getParameterMetaData();// <-- !!!! Exception is thrown here
for (int i = 1, count = pmd.getParameterCount(); i <= count; i++)
{
System.err.println(">>>>AD_TEMP " + pmd.getParameterType(i) + " " + pmd.getParameterTypeName(i) + " " + pmd.getParameterMode(i));
}

Thanks,
Alexander Dolgin

View 1 Replies View Related

Why Does Bulk Insert Task Not Work From Remote Servers With Windows Authentication?

Jun 10, 2007

Using Bulk Insert Task extensively in our solution. Everything was working great till we deployed it in stage columns. The database server is different from application servers. We have ASP.NET web services driving SSIS packages on application server. After struggling thru several security issues to get this working (ended up creating an application pool with a domain account) we are now stuck with this problem. On a different note still don't understand what specific security permission is available to domain account that makes it work.

Read in some blog that SQL Server 2005 SP2 Beta had this (Bulk Insert) fixed but not in final production version. Is there a specific reason why this is so?

SSIS and the API is quite easy to work with but associated security and deployment issues are not always clear. A lot of answers seem to be coming from end users - thanks a lot to all for sharing your experiences - sadly not presented clearly in SSIS documentation.

View 2 Replies View Related

SQL Server 2012 :: Set Based Method To Insert Missing Records Into Table - Right Join Not Work

Apr 24, 2014

I have table A (EmployeeNumber, Grouping, Stages)
and
Table B (Grouping, Stages)

Table A could look like the following where the multiple employees could have multiple types and multiple stages.

EmployeeNumber, Type, Stages
100, 1, Stage1
100, 1, Stage2
100, 2, Stage1
100, 2, Stage2
200, 1, Stage1
200, 2, Stage2

Table B is a list of requirements that each employee must have. So every employee must have a type 1 and 2 and the associated stages listed below.

Type, Stage
1, Stage1
1, Stage2
2, Stage1
2, Stage2
2, Stage3
2, Stage4

So I know that each employee should have 2 Type 1's and 4 Type 2's. I hope that makes sense, I'm trying to change my data because ours is very proprietary.

I need to identify employees who do not have all their stages and list the stages they are missing. The final report should only have employees and the associated missing types and stages.

I do a count by employee to see how many types they have to identify the ones that don't have all the types and stages.

My count would look something like this:

EmployeeNumber Type Total
100, 1, 2
100, 2, 2
200, 1, 1
200 1, 2

So I know that employee 100 should have 2 more Type 2's and employee 200 should have 1 more Type 1 and 2 more Type 2's based on the required list.

The problem I'm having is taking that required list and joining to my list of employees with missing data and pulling from it the types and stages that are missing by employee. I thought I could get a list of the employees that are missing information and right join it to the required list where the missing records would be nulls. But, that doesn't work because some employees do have the required information and so I'm not getting any nulls returned.

View 9 Replies View Related

Char(1) And Char(2) Take Same Space?

Aug 21, 2007

I create two tables:

create table table1
(
col1 char(1)
)

go

create table table2
(
col2 char(2)
)

go

I add some records to two tables after createing operation completed.

Then i use dbcc page command to oversee the structures of data page in two tables.
I found some interest things:
The rows in two tabes take up same space:9 bytes

You can see the "9" on top of the data, for example:Slot 0, Offset 0x60, Length 9, DumpStyle BYTE
or calculate from the offset array



Any suggestions?

View 14 Replies View Related

Bit Or Char?

Dec 8, 2005

Sql Server uses bit field for boolean while Access uses Y/N. What are the pros and cons of either way? Thanks.

View 14 Replies View Related

What Does It Mean Char(13) And Char(10)

May 4, 2000

What does it mean char(13) and char(10) when I use this in my sql code

ali

View 1 Replies View Related

Char To Bit

Jul 23, 2005

I am importing a table where I need to convert a char(1) with thevalues of 't' or 'f' into a bit field with valies of 1 or 0. Is therea built-in function that does that? I've been searching, but I can'tfind an answer.

View 6 Replies View Related

Concatenate Int && Var Char - SQL

Oct 1, 2007

Hi, I am trying to write some simple SQL to join two fields within a table, the primary key is an int and the other field is a varchar. But i am receiving the error:'Conversion failed when converting the varchar value ',' to data type int.The SQL I am trying to use is:select game_no + ',' + team_name as matchfrom result  Thanks 

View 2 Replies View Related

Char Vs Varchar

Dec 5, 2001

Hi,

Does any body know of any performance implications of using 'varchar' data type against 'char'?

I have some columns that are using 'char' data type, but the data in them is not fixed length. So, to gain some disk space I am planning to change the data type to 'varchar'. But, I am concerned if there will be any performance de-gradation or any other implications of doing this.

Regards
Chakri

View 3 Replies View Related

CHAR Vs VARCHAR

Mar 26, 2001

Hi,

Is that true that using CHAR datatype improves the performance comparing to VARCHAR

thanks
indeed.

View 3 Replies View Related

Non-English Char

Nov 2, 2000

Would the char or varchar datatype fieldname accept non-english letters like Japanees, Chinees, Russian..etc.

Or should I use nchar or nvarchar?

Thanks

View 2 Replies View Related

VARCHAR Vs. CHAR

Oct 27, 2000

Why would you want to use char when you have varchar? Is there any performance hit using a varchar and the size you make that varchar?

Debate going at work.

Phil

View 7 Replies View Related

Varchar V Char

Feb 17, 1999

I have recently inherited a database where all of the tables use varchar instead of chars for fields. Very , very few of these fields are involved in keys of even indices, but performance is an issue. I thought that I had read that varchars are worse for performance than chars when page splits may occur. Is this related to updates only, or does it matter?

Any help appreciated.

View 1 Replies View Related

Char (8) Vs. Varchar (8)

May 8, 2006

In relation to the code in this thread

http://forums.databasejournal.com/showthread.php?t=42622

My customer code field is Char (8) but accept an argument of Varchar (8) to my stored procedure. Don't ask me why!?!!

The customer code could be anything from 'A' to 'ZZZZZZZZ'.

Will this have any effect especially relating to overhead and retrieving incorrect data?

View 1 Replies View Related

Addition Of Char + Int !!!

Jan 15, 2002

Hi Everybody,

I hv executed the following query in the Query Qnalyzer
(Ofcourse I am Using SQL 2000 Enterprise Edition) and Surprisingly
I am getting the Output as follows,

query:-
select '5' + 10

Output:- 15

Can anybody please tell me, why it is happening like this? OR Did I miss any Configuration Parameter in the Server Settings?.

Tks in Advance,
Sam

View 1 Replies View Related

Getting MAX From Char Numbers

Jul 28, 2001

I have a table which will recieve and interface file to be loaded. All the fields are there except an account_id field which is a char(12), but the data is a number 000000000001, 000000000002, etc. These numbers are to be incremented by one. I understand how to write the process using a cursor to run through all the records and to increment them before loading. My question is the best way to get the max number in the existing table which is the char(12) , and icrement the number by one, but retain the leading zeroes I will need. Anyone had the pleasure of doing this providing input greatly appreciated.

View 5 Replies View Related

Convert Char(1) To Int

Feb 12, 2008

I'm looking through some data in a third party application, trying to figure something out for a report. There is a char(1) column holding control characters that apparently effects the status of certain records, and whether they should appear on the report. I want to look at the integer value of those characters rather than the character representation, but I can't get it to work. I keep getting "Error converting data type varchar to numeric." I'm trying to do something like this:
Code:

SELECT CONVERT(int, MyColumn) As IntValue FROM MyTable

I've tried every combination of cast and convert I can think of, as well as numeric data types other than int. There aren't that many distinct values, so I'm just going to do this manually, but I still want to know why it won't work, or what I'm doing wrong. Any thoughts?

View 2 Replies View Related

Char Type In MS SQL

Dec 12, 2005

Dear All,

I am new to MS SQL. One VB application that I need to maintain using it.
There is one problem reported but I couldn't explain: one field is declared
as Char (20), but the application seems able to insert a string with length
even 30. There is no character truncatd when retrieved neither.

However, I cannot simulate the case in the MSSQL database manager. When I executed a SQL script to insert, I was simply not allowed to do so.

Any explanation to the sDid anyone encounter same thing before?
Thanks for any hint.


Regards

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved