显示标签为“type”的博文。显示所有博文
显示标签为“type”的博文。显示所有博文

2012年3月29日星期四

bcp_bind and SQL DATETIME type

Hi all,
I'm working on a simple ODBC API bulk load application and I've run
into a problem. I am binding variables in memory and sending the rows
as prescribed in the ODBC 3.0 API Reference and on MSDN. Everything
works fine for SQL VARCHAR and SQL INTEGER data types; however, I run
into issues when I try to bind SQL DATETIME data types. I can't seem
to find examples of how this should be done anywhere... Should my
variable that I'm binding to be a C-Style string or a
SQL_TIMESTAMP_STRUCT or a time_t structure? It's all a blur...
Anyone know where I can find a sample that bcp_binds to a DATETIME
column in a table?
TIANever mind, issue resolved.
"Michael C#" wrote:

> Hi all,
> I'm working on a simple ODBC API bulk load application and I've run
> into a problem. I am binding variables in memory and sending the rows
> as prescribed in the ODBC 3.0 API Reference and on MSDN. Everything
> works fine for SQL VARCHAR and SQL INTEGER data types; however, I run
> into issues when I try to bind SQL DATETIME data types. I can't seem
> to find examples of how this should be done anywhere... Should my
> variable that I'm binding to be a C-Style string or a
> SQL_TIMESTAMP_STRUCT or a time_t structure? It's all a blur...
> Anyone know where I can find a sample that bcp_binds to a DATETIME
> column in a table?
> TIA
>|||Hello Michael,
Can you please show me an example that "works fine for SQL VARCHAR"? I just
can't send text using the bcp...
TIA
quote:
Originally posted by Michael C
Never mind, issue resolved.
"Michael C#" wrote:

> Hi all,
> I'm working on a simple ODBC API bulk load application and I've run
> into a problem. I am binding variables in memory and sending the rows
> as prescribed in the ODBC 3.0 API Reference and on MSDN. Everything
> works fine for SQL VARCHAR and SQL INTEGER data types; however, I run
> into issues when I try to bind SQL DATETIME data types. I can't seem
> to find examples of how this should be done anywhere... Should my
> variable that I'm binding to be a C-Style string or a
> SQL_TIMESTAMP_STRUCT or a time_t structure? It's all a blur...
> Anyone know where I can find a sample that bcp_binds to a DATETIME
> column in a table?
> TIA
>

|||Hi Michael, i am facing similar issue i.e. failing of bcp_binf for datetime
datatpye. Can You please share the solution that you have for this issue?
Thanks in advance.
From http://developmentnow.com/g/111_200...
ype.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

2012年3月6日星期二

BCP Errors

I execute a store procedure like
Sploadnew 'may'
The may is char type which is converted to a datetime and the query is
something like and I create a tem table
SELECT into ##tetable SUM(sales)+SUM(sales1)
FROM table
group by state
where datepart(mm,prod_date)=datepart(mm,@.datenew)
I want to BCP this result to a server location from within the store
procedure and I did
exec master..xp_cmdshell BCP ##tetable
OUT "//server/folder/rsult.txt"
-S server
-U sa
-P Password
I get this error
erver: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '##tetable'
what is wrong in this approach
Any Answers?I'm not quite sure where the error is occurring here, but
one way to help to determine this is instead of using the
actual BCP command syntax within the xp_cmdshell call
(which may be what is causing the SQL parser to find an
error), put your BCP command in a Windows NT .cmd command
file. Then use xp_cmdshell to execute this .cmd file.
This should eliminate any wacky allowable syntax
differences between what BCP allows and what the SQL
parser allows.
Also, I don't know if you left this out just in your post
or if you left it out in your stored proc, but you might
want to try enclosing the entire BCP command syntax in
single quotes:
exec master..xp_cmdshell 'BCP ##tetable
OUT "//server/folder/rsult.txt"
-S server
-U sa
-P Password'
generally, with xp_cmdshell, if your command syntax
includes spaces, the commnad syntax needs to be within
single quotes.
I hope that this helps.
Matthew Bando
BandoM@.CSCTechnologies (remove) . com
>--Original Message--
>I execute a store procedure like
>Sploadnew 'may'
>The may is char type which is converted to a datetime
and the query is
>something like and I create a tem table
>SELECT into ##tetable SUM(sales)+SUM(sales1)
>FROM table
>group by state
>where datepart(mm,prod_date)=datepart(mm,@.datenew)
>I want to BCP this result to a server location from
within the store
>procedure and I did
>exec master..xp_cmdshell BCP ##tetable
>OUT "//server/folder/rsult.txt"
>-S server
>-U sa
>-P Password
> I get this error
>erver: Msg 170, Level 15, State 1, Line 1
>Line 1: Incorrect syntax near '##tetable'
>what is wrong in this approach
>Any Answers?
>
>.
>

2012年2月16日星期四

BC30311: Value of type System.Data.SqlClient.SqlDataReader cannot be converted to String.

Does anyone know what the problem is?


Sub Page_Init(sender As Object, e As EventArgs)
Dim txtName As New TextBox()
Dim txtPart As New TextBox()
Dim txtEach As New TextBox()
Dim txtTotal1 As New TextBox()
Dim txtSubtotal As New TextBox()
Dim txtTax As New TextBox()
Dim txtShipping As New TextBox()
Dim txtTotal2 As New TextBox()

Dim prod_id As Integer
Dim id As Integer
id = Request.Querystring("prod_id")
txtName.Text = GetName(id).............this is the problem line

phName.Controls.Add(txtName)
phPart.Controls.Add(txtPart)
phEach.Controls.Add(txtEach)
phTotal1.Controls.Add(txtTotal1)
phSubtotal.Controls.Add(txtSubtotal)
phTax.Controls.Add(txtTax)
phShipping.Controls.Add(txtShipping)
phTotal2.Controls.Add(txtTotal2)

End Sub

I'm trying to populate dynamically rendered textbox's, how should I do that too?What are you doing within the GetName function call? Seems to me the problem is in there.

2012年2月12日星期日

Basket Analysis

Hi,
Does anyone know of any good examples of cube construction
for basket analysis, I can't seem to find much of anything
on this particular type of analysis.
Ta
Paul
You might find some interesting material here:
http://www.ralphkimball.com/html/articles.html
Dave Wickert [MSFT]
dwickert@.online.microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Paul" <anonymous@.discussions.microsoft.com> wrote in message
news:389501c4aeec$a2c634b0$a601280a@.phx.gbl...
> Hi,
> Does anyone know of any good examples of cube construction
> for basket analysis, I can't seem to find much of anything
> on this particular type of analysis.
> Ta
> Paul

Basket Analysis

Hi,
Does anyone know of any good examples of cube construction
for basket analysis, I can't seem to find much of anything
on this particular type of analysis.
Ta
PaulYou might find some interesting material here:
http://www.ralphkimball.com/html/articles.html
--
Dave Wickert [MSFT]
dwickert@.online.microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Paul" <anonymous@.discussions.microsoft.com> wrote in message
news:389501c4aeec$a2c634b0$a601280a@.phx.gbl...
> Hi,
> Does anyone know of any good examples of cube construction
> for basket analysis, I can't seem to find much of anything
> on this particular type of analysis.
> Ta
> Paul

2012年2月11日星期六

basic timestamp question.

Hello I have a very basic timestamp question. There is a data type in SQl Servertimestamp.

what I basically want is that when someone Inserts a data the timestamp column puts a timestamp there...how can i achieve that?...I thought that the timestamp type automatically does that

Yes you cannot insert into a timestamp column. SQL Server does that for you.

|||

If it puts a time stamp then instead of seeing some date when I open the table and look under the timestamp column I see something like: 0x00000000E4EBF66E

what does that mean? why it is not putting date there?

|||

Thats the hex value of the date/time value. Its very specific. I forget what measure of time it measures to, but its very specific.

Tim

|||

sahajMarg:

If it puts a time stamp then instead of seeing some date when I open the table and look under the timestamp column I see something like: 0x00000000E4EBF66E

what does that mean? why it is not putting date there?

Yes its a binary number assigned by SQL Server. you should read up books online for timestamp columns to understand where/how it can be used.

|||

sahajMarg:

If it puts a time stamp then instead of seeing some date when I open the table and look under the timestamp column I see something like: 0x00000000E4EBF66E

what does that mean? why it is not putting date there?

Yes its a binary number assigned by SQL Server. you should read up books online for timestamp columns to understand where/how it can be used.

|||

Just read it the same post the it is the Hex value of date and time..is that correct?