943,753 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Marked Solved
  • Views: 1666
  • MS SQL RSS
Apr 25th, 2008
0

MS SQL insertion via VB (Query question)

Expand Post »
I am trying to insert tables into a database that I created at runtime, I am using MS SQL Server Express, and I have tested this query and it works, in the sense that a table is created. However the small text field (stringText [char]) only has a length of 1, that is not very useful... When I try to specify a length i.e. varchar(MAX) or varchar(255) or any other value really it gives me an error that Column, parameter, or variable #2: Cannot find data type varchar(255).

I have set up a msg box to show the SQL that I generate whenever I run the program. It is as follows:
MS SQL Syntax (Toggle Plain Text)
  1. ---------------------------
  2. Portfolio Generator 3.0
  3. ---------------------------
  4. Inserting INTO DATABASE:
  5. BEGIN TRANSACTION CREATE TABLE [dbo].[testTable] ( [testTableID] [int] NOT NULL PRIMARY KEY, stringText [char] NULL DEFAULT (''), largeText [text] NULL DEFAULT (''), integerVal [int] NULL DEFAULT ((0)), doubleVal [int] NULL DEFAULT ((0)), dateVal [datetime] NULL DEFAULT (04/25/2008), boolVal [tinyint] NULL DEFAULT ((0))) COMMIT

Any questions about something I may have left out will be happily answered, and any help that is given, thank you in advance.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
Mr.Wobbles is offline Offline
49 posts
since Jun 2007
May 9th, 2008
1

Re: MS SQL insertion via VB (Query question)

get rid of the square brackets around the varchar(255) and it will work fine.

For that matter, why are you putting them around the datatypes anyway? I've never seen anyone do that.
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Need help SQL Assignment
Next Thread in MS SQL Forum Timeline: Sql Sort Query....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC