Showing posts with label themselves. Show all posts
Showing posts with label themselves. Show all posts

Thursday, March 8, 2012

Columns inster into problem

Hi Every1,
This is the first time I'm trying to use columns by themselves instead
of using individual values.
And I'm getting an error.
Here is my sql
INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
& the Error is
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ','.
I've matched all the columns. Second table have extra columns & I
didn't included them because then the columns will not match.
Also I only want to insert the values which are not currently present
in table 1.
Thanks in advance for your help.
Try...
INSERT INTO PS_CUST_CONTACT
SELECT SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
Almost correct but you didn't need the brackets around the select columns,
and you don't need column names in the insert.
Peter
"You can always count on Americans to do the right thing - after they've
tried everything else."
Winston Churchill
"aspnetpal" wrote:

> Hi Every1,
> This is the first time I'm trying to use columns by themselves instead
> of using individual values.
> And I'm getting an error.
> Here is my sql
> INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
> ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
> SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
> LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
> NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
> & the Error is
> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near ','.
> I've matched all the columns. Second table have extra columns & I
> didn't included them because then the columns will not match.
> Also I only want to insert the values which are not currently present
> in table 1.
> Thanks in advance for your help.
>
|||Hello Peter, thanks for your suggestion.
After removing the brackets it worked just fine.
Thanks

Columns inster into problem

Hi Every1,
This is the first time I'm trying to use columns by themselves instead
of using individual values.
And I'm getting an error.
Here is my sql
INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
& the Error is
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ','.
I've matched all the columns. Second table have extra columns & I
didn't included them because then the columns will not match.
Also I only want to insert the values which are not currently present
in table 1.
Thanks in advance for your help.Try...
INSERT INTO PS_CUST_CONTACT
SELECT SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
Almost correct but you didn't need the brackets around the select columns,
and you don't need column names in the insert.
Peter
"You can always count on Americans to do the right thing - after they've
tried everything else."
Winston Churchill
"aspnetpal" wrote:

> Hi Every1,
> This is the first time I'm trying to use columns by themselves instead
> of using individual values.
> And I'm getting an error.
> Here is my sql
> INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
> ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
> SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
> LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
> NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
> & the Error is
> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near ','.
> I've matched all the columns. Second table have extra columns & I
> didn't included them because then the columns will not match.
> Also I only want to insert the values which are not currently present
> in table 1.
> Thanks in advance for your help.
>|||Hello Peter, thanks for your suggestion.
After removing the brackets it worked just fine.
Thanks

Columns inster into problem

Hi Every1,
This is the first time I'm trying to use columns by themselves instead
of using individual values.
And I'm getting an error.
Here is my sql
INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
& the Error is
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ','.
I've matched all the columns. Second table have extra columns & I
didn't included them because then the columns will not match.
Also I only want to insert the values which are not currently present
in table 1.
Thanks in advance for your help.Try...
INSERT INTO PS_CUST_CONTACT
SELECT SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
LAST_MAINT_OPRID, DATE_LAST_MAINT FROM PS_CONTACT_CUST WHERE CUST_ID
NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
Almost correct but you didn't need the brackets around the select columns,
and you don't need column names in the insert.
Peter
"You can always count on Americans to do the right thing - after they've
tried everything else."
Winston Churchill
"aspnetpal" wrote:
> Hi Every1,
> This is the first time I'm trying to use columns by themselves instead
> of using individual values.
> And I'm getting an error.
> Here is my sql
> INSERT INTO PS_CUST_CONTACT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS,
> ADDRESS_SEQ_NUM, LAST_MAINT_OPRID, DATE_LAST_MAINT)
> SELECT (SETID, CUST_ID, CNTCT_SEQ_NUM, EFF_STATUS, ADDRESS_SEQ_NUM,
> LAST_MAINT_OPRID, DATE_LAST_MAINT) FROM PS_CONTACT_CUST WHERE CUST_ID
> NOT IN(SELECT CUST_ID FROM PS_CUST_CONTACT)
> & the Error is
> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near ','.
> I've matched all the columns. Second table have extra columns & I
> didn't included them because then the columns will not match.
> Also I only want to insert the values which are not currently present
> in table 1.
> Thanks in advance for your help.
>|||Hello Peter, thanks for your suggestion.
After removing the brackets it worked just fine.
Thanks

Wednesday, March 7, 2012

Column Widths

Is there a way to have columns automatically size themselves based on the
contents of the column name and data? I guess I'm looking for something
similar to Excel's Format|Column|AutoFit Selection option.
What I see happening with our reports is that a column name of...
Reservation Departure Date
...appears as...
Reservation
Depart Da
te
I would prefer to see the column heading in a single line of...
Reservation Departure Date
...however, I don't want to have to resize every report column to make the
contents of the column appear like this.
Is there a simple report setting to do an autofit?Yes Andy, I face this problem too!
Up to now, do you have any ways to fix this problem'
Super thanks if anyone can fix it!
"Andy" wrote:
> Is there a way to have columns automatically size themselves based on the
> contents of the column name and data? I guess I'm looking for something
> similar to Excel's Format|Column|AutoFit Selection option.
> What I see happening with our reports is that a column name of...
> Reservation Departure Date
> ...appears as...
> Reservation
> Depart Da
> te
> I would prefer to see the column heading in a single line of...
> Reservation Departure Date
> ...however, I don't want to have to resize every report column to make the
> contents of the column appear like this.
> Is there a simple report setting to do an autofit?
>
>