I'm working on a stored procedure in SQL SERVER 2012.
Suddenly, my stored procedure can't compile.
it says invalid column name on every column I try to add.
But I can run queries and the columns are there
SELECT FirstName FROM dbo.Contacts
Also, I made no change to the code.
I tried to reboot
I recreated the columns
I refreshed the intelliSense cache
No luck...
here's a part of the code
DECLARE curContact Cursor
FOR SELECT dbo.Contacts.ContactID, dbo.Contacts.FirstName, dbo.Contacts.MiddleName, dbo.Contacts.LastName, dbo.Contacts.ContactName FROM dbo.Contacts
FOR UPDATE OF dbo.Contacts.FirstName, dbo.Contacts.MiddleName, dbo.Contacts.LastName
OPEN curContact
here's the table structure
CREATE TABLE [dbo].[Contacts](
[ContactID] [int] NOT NULL,
[MillID] [int] NULL,
[ClientID] [int] NULL,
[FirstName] [nvarchar](64) NULL,
[MiddleName] [nvarchar](64) NULL,
[LastName] [nvarchar](64) NULL,
[Gender] [bit] NULL,
[ContactName] [nvarchar](50) NULL,
[ContactTitle] [nvarchar](50) NULL,
[ContactPhoneNo] [nvarchar](50) NULL,
[ContactPhoneExt] [nvarchar](50) NULL,
[ContactFaxNo] [nvarchar](50) NULL,
[ContactEmail] [nvarchar](50) NULL,
[Comment] [nvarchar](max) NULL,
[CreatedBy] [nvarchar](50) NULL,
[CreatedDate] [datetime] NULL,
[ModifiedBy] [nvarchar](50) NULL,
[ModifiedDate] [datetime] NULL,
[ContactCellNo] [nvarchar](50) NULL,
[ContactPageNo] [nvarchar](50) NULL,
[ContactHomeNo] [nvarchar](50) NULL,
[ContactOtherNo] [nvarchar](50) NULL,
[Language] [nvarchar](15) NULL,
[CalendarQuantityEnglish] [smallint] NULL,
[CalendarQuantityFrench] [smallint] NULL,
[CalendarKeepBy] [nvarchar](50) NULL,
[CalendarComment] [nvarchar](250) NULL,
[OtherQuantityEnglish] [smallint] NULL,
[OtherQuantityFrench] [smallint] NULL,
[OtherKeepBy] [nvarchar](50) NULL,
[OtherComment] [nvarchar](250) NULL,
[Validated] [date] NULL,
[ValidedByWho] [nvarchar](64) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Any idea?
You need to refresh SSMS Intellisense Cache (CTRL + SHIFT + R or Edit -> Intellisense -> Refresh Local Cache).
Related
I am new to CodeIgniter. I do only display my first table but I don't have idea to join and display my second table at the same time, I tried codeigniter3 guide $this->db->join(); but still I'm stuck in my project.
Controller:
function ez($id) {
$this->load->model('Join_model');
$data['results']= $this->Join_model->getalldata($id);
$this->load->view('join_view',$data);
}
Model:
function getalldata($id) {
$this->db->where('id',$id);
$query = $this->db->get('tickets');
if($query){
return $query->row();
}
}
views
<div class="col-sm-4 invoice-col">
<b>Ticket ID:</b>  <?php echo $results->id; ?><br>
<b>Business Name:</b>  <?php echo $results->bus_name; ?><br>
<b>Full Address:</b>  <?php echo $results->address; ?><br>
<b>Owner Name:</b>  <?php echo $results->owner_name; ?><br>
<b>Phone Number:</b>  <?php echo $results->owner_number; ?><br>
<b>Point Person:</b>  <?php echo $results->pt_person; ?><br>
<b>Phone Number:</b>  <?php echo $results->pt_person_number; ?><br>
</div>
table1
CREATE TABLE `tickets` (
`id` int(11) NOT NULL,
`as_name` varchar(50) NOT NULL,
`create_date` datetime NOT NULL,
`bus_name` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`owner_name` varchar(255) NOT NULL,
`owner_number` int(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
table2
CREATE TABLE `tickets_reply` (
`id` int(11) NOT NULL,
`tickets_id` int(11) NOT NULL,
`remarks` varchar(255) NOT NULL,
`comment` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
pt_person & pt_person_number referenced in your view file is not in any of the tables you referenced. However, I think this is what you're looking for.
function getalldata($id) {
$this->db->select('t.id, t.bus_name, t.address, t.owner_name, t.owner_number'); // add more columns here
$this->db->where('id', $id);
$this->db->from('tickets t');
$this->db->join('tickets_reply tr', 't.id = tr.tickets_id', 'left');
return $this->db->get()->row_object();
}
Read more about the join method here https://codeigniter.com/userguide3/database/query_builder.html?highlight=join#CI_DB_query_builder::join
We're using the following code to add a table with 3 columns and a number of rows determined by the number of items in a collection. The first row in the table has headers. We want to bold them but I can't figure out how to do that. I was reading through this but it wasn't making sense on how to get the start and end index of the text in the header row.
var body = new BatchUpdateDocumentRequest {Requests = new List<Request>()
{
new Request()
{
InsertTable = new InsertTableRequest()
{
EndOfSegmentLocation = new EndOfSegmentLocation
{
SegmentId = ""
},
Columns = 3,
Rows = contractAddendums.Items.Count
}
}
}};
docService.Documents.BatchUpdate(body, docId).Execute();
var doc = docService.Documents.Get(newDocId).Execute();
var table = doc.Body.Content.FirstOrDefault(x => x.Table != null).Table;
var requests = new List<Request>();
for (var i = contractAddendums.Items.Count - 1; i > -1; i--){
var row = contractAddendums.Items[i];
var r1 = new Request()
{
InsertText = new InsertTextRequest()
{
Text = row.Text,
Location = new Location()
{
Index = table.TableRows[i].TableCells[2].Content[0].StartIndex
}
}
};
var r2 = new Request()
{
InsertText = new InsertTextRequest()
{
Text = row.Variable,
Location = new Location()
{
Index = table.TableRows[i].TableCells[1].Content[0].StartIndex
}
}
};
var r3 = new Request()
{
InsertText = new InsertTextRequest()
{
Text = row.Title,
Location = new Location()
{
Index = table.TableRows[i].TableCells[0].Content[0].StartIndex
}
}
};
requests.Add(r1);
requests.Add(r2);
requests.Add(r3);
}
As requested here's a sample of the request body. The actual request is much longer but essentially the same as it's simply an array of the same type of request objects.
[{
"createNamedRange": null,
"createParagraphBullets": null,
"deleteContentRange": null,
"deleteNamedRange": null,
"deleteParagraphBullets": null,
"deletePositionedObject": null,
"deleteTableColumn": null,
"deleteTableRow": null,
"insertInlineImage": null,
"insertPageBreak": null,
"insertTable": null,
"insertTableColumn": null,
"insertTableRow": null,
"insertText": {
"endOfSegmentLocation": null,
"location": {
"index": 15806,
"segmentId": null,
"ETag": null
},
"text": "asdfasdfad",
"ETag": null
},
"replaceAllText": null,
"updateParagraphStyle": null,
"updateTableColumnProperties": null,
"updateTableRowStyle": null,
"updateTextStyle": null,
"ETag": null
}, {
"createNamedRange": null,
"createParagraphBullets": null,
"deleteContentRange": null,
"deleteNamedRange": null,
"deleteParagraphBullets": null,
"deletePositionedObject": null,
"deleteTableColumn": null,
"deleteTableRow": null,
"insertInlineImage": null,
"insertPageBreak": null,
"insertTable": null,
"insertTableColumn": null,
"insertTableRow": null,
"insertText": {
"endOfSegmentLocation": null,
"location": {
"index": 15804,
"segmentId": null,
"ETag": null
},
"text": "asdfasdf",
"ETag": null
},
"replaceAllText": null,
"updateParagraphStyle": null,
"updateTableColumnProperties": null,
"updateTableRowStyle": null,
"updateTextStyle": null,
"ETag": null
}]
You want to modify the text style of texts in a table.
You want to modify the text style of the header which is the first row of the table.
You have already been able to put and get for Google Document using Google Docs API.
If my understanding is correct, how about this answer? Please think of this as just one of several answers.
Issue:
At your request body, it is found that the text is inserted. In order to achieve above, it is required to update the text style. But at first, it is required to retrieve the indexes of cells of the header row.
Solution:
Here, I would like to explain this flow using a sample situation. As the sample situation, it uses the following Google Document. As a test case for your situation, the texts of header1, header2 and header3 of the header row are modified as the bold style.
Flow:
Retrieve the table using the method of documents.get of Docs API.
At that time, when the following "fields" parameter is used, the readability of data can be increased.
body(content(table(tableRows(tableCells(content(paragraph(elements(endIndex,startIndex,textRun/content))))))))
The endpoint is as follows.
GET https://docs.googleapis.com/v1/documents/{documentId}?fields=body(content(table(tableRows(tableCells(content(paragraph(elements(endIndex%2CstartIndex%2CtextRun%2Fcontent))))))))
When the method of documents.get is requested with above endpoint, the following value is returned.
{"body":{"content":[{},{},{},{},
{"table":{
"tableRows":[
{"tableCells":[
{"content":[{"paragraph":{"elements":[{"startIndex":14,"endIndex":22,"textRun":{"content":"header1\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":23,"endIndex":31,"textRun":{"content":"header2\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":32,"endIndex":40,"textRun":{"content":"header3\n"}}]}}]}
]},
{"tableCells":[
{"content":[{"paragraph":{"elements":[{"startIndex":42,"endIndex":49,"textRun":{"content":"value1\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":50,"endIndex":57,"textRun":{"content":"value2\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":58,"endIndex":65,"textRun":{"content":"value3\n"}}]}}]}
]},
{"tableCells":[
{"content":[{"paragraph":{"elements":[{"startIndex":67,"endIndex":74,"textRun":{"content":"value4\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":75,"endIndex":82,"textRun":{"content":"value5\n"}}]}}]},
{"content":[{"paragraph":{"elements":[{"startIndex":83,"endIndex":90,"textRun":{"content":"value6\n"}}]}}]}
]}
]
}},
{},{},{},{}]}}
The first index of tableRows is the header row.
Retrieve the indexes of header1, header2 and header3.
From the retrieved table data, it was found that "startIndex":14,"endIndex":22, "startIndex":23,"endIndex":31 and "startIndex":32,"endIndex":40 are the indexes for header1, header2 and header3, respectively.
By using the method of documents.batchUpdate with these values, the text style of texts of the header row can be modified to the bold style.
The endpoint is as follows.
POST https://docs.googleapis.com/v1/documents/{documentId}:batchUpdate
The request body is as follows.
{"requests":[
{"updateTextStyle":{"range":{"startIndex":14,"endIndex":22},"textStyle":{"bold":true},"fields":"bold"}},
{"updateTextStyle":{"range":{"startIndex":23,"endIndex":31},"textStyle":{"bold":true},"fields":"bold"}},
{"updateTextStyle":{"range":{"startIndex":32,"endIndex":40},"textStyle":{"bold":true},"fields":"bold"}}
]}
When this endpoint with the request body is requested, the following result can be obtained.
Result:
References:
Method: documents.get
Method: documents.batchUpdate
UpdateTextStyleRequest
If you want to bold some text. You need to submit a request similar to the following:
requests = [
{
'updateTextStyle': {
'range': {
'startIndex': 1,
'endIndex': 5
},
'textStyle': {
'bold': True,
},
'fields': 'bold'
}
},
]
The range: {'startIndex': 1, 'endIndex':5} should reference the range of text that should be bold.
I have generate credentials for a service account like this:
f = file(settings.SERVICE_ACCOUNT_PKCS12_FILE_PATH, 'rb')
key = f.read()
f.close()
credentials = client.SignedJwtAssertionCredentials(settings.SERVICE_ACCOUNT_EMAIL, key, scope=settings.GROUPS_SCOPE, sub=settings.ADMIN_DOMAIN_EMAIL)
print 'credentials : '+str(credentials.to_json())
the print display the credentials in json format :
{"private_key": "MIIGwAIBAzCCBnoGLUn09Ywa1l7G8XC2SgA9eDhXAdKw4DAh...83J+6iAgIEAA==", "id_token": null, "token_uri": "https://accounts.google.com/o/oauth2/token", "token_response": null, "client_id": null, "scope": "https://www.googleapis.com/auth/admin.directory.group", "token_expiry": null, "_class": "SignedJwtAssertionCredentials", "refresh_token": null, "_module": "oauth2client.client", "private_key_password": "notasecret", "access_token": null, "service_account_name": "xxx#developer.gserviceaccount.com", "invalid": false, "assertion_type": null, "kwargs": {"sub": "username#domain.com"}, "client_secret": null, "revoke_uri": "https://accounts.google.com/o/oauth2/revoke", "user_agent": null}
This generate a private key ans access token that is null.
Is there a class that handels REST request specified here to get the access token ?
You can use access_token = credentials.get_access_token()
https://oauth2client.readthedocs.io/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials.get_access_token
I have a Google LineChart with multiple lines. These points do not share the same X value's so i have to format my data in a certain way to make it work:
var data = google.visualization.arrayToDataTable([
["Y", "Your X & Y", "Product 1", "Product 2", "Product 3"],
[419, 589, null, null, null],
[386, null, 504, null, null],
[386, null, 526, null, null],
[387, null, 543, null, null],
[395, null, 564, null, null],
[402, null, 591, null, null],
[408, null, 612, null, null],
[378, null, null, 501, null],
[398, null, null, null, 600],
[460, null, null, null, 500]
]);
Now i want to add custom tooltips to these lines, i've tried adding an extra column and setting the role to tooltip.. but this only affects the first line.
see both charts (with and without tooltip): http://jsfiddle.net/TD92C/8/
How do i add custom tooltips for all lines? Thanks
SOLVED:
http://jsfiddle.net/asgallant/TD92C/14/
you have to make your variable like this
var data = google.visualization.arrayToDataTable([
//Columns
["Y", //Name of the X-axis marker
"Your X & Y",{type: 'string', role: 'tooltip'},
"Product 1",{type: 'string', role: 'tooltip'},
"Product 2",{type: 'string', role: 'tooltip'},
"Product 3",{type: 'string', role: 'tooltip'},],
//Rows
//Add tooltip column after every value in each row
[419,589,"tooltip info about your x & y",null,'',null,'',null,''],
[386,null,'',504,'','Custom Tooltip',null,'',null,''],
[386,null,'',526,'Custom Tooltip',null,'',null,''],
[387,null,'',543,'Custom Tooltip',null,'',null,''],
[378,null,'',null,'',501,'Custom Tooltip',null,''],
[383,null,'',null,'',511,'Custom Tooltip',null,''],
[368,null,'',null,'',null,'',526,'Custom Tooltip'],
[373,null,'',null,'',null,'',547,'Custom Tooltip'],
]);
Fiddle
Data is looking different but if you correct the first element to a string which is exactly as the columns displayed in 1st column index it will be correct
I get this erorr eerytime I try to create a user from the console. I used to be able to do this, but ever since I turned off PT maintenance, this could have become a problem.
Thing is I do supply a value for the PT using Authlogic::Random.friendly_token, but it seems this value never shows up in the SQL statement.
What do I need to do ?
ActiveRecord::StatementInvalid: /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in log': Mysql::Error: Column 'perishable_token' cannot be null: INSERT INTOusers(city,zip,created_at,single_access_token,image_file_name,voting_power,crypted_password,image_file_size,image_url,updated_at,perishable_token,username,role_id,image_content_type,lng,posts_count,failed_login_count,current_login_ip,sex,password_salt,current_login_at,persistence_token,login_count,last_login_ip,age,lat,last_login_at,image_updated_at,email,state,active,processing`) VALUES(NULL, '94131', '2010-09-07 16:26:38', '8R0L3UMxlytO2QNrXMQ', NULL, 0, '3590f21c99ecad3fa2ece943d23f55af735e9713d0d325111763b10b3e3f8a455e7ed323b6b3f5d7a721f5afc81beff5da1f2d6b20454c399751eed1623d3b7d', NULL, NULL, '2010-09-07 16:26:38', NULL, 'asitmi', NULL, NULL, NULL, 0, 0, NULL, 1, 'mrqq5O4gFsyMcExLEOsH', NULL, 'b3ff5cd7e942212b1976f8d57941516489a0cbc4360493ff3f9b2e17e4aae48c3f53944674745ef911ca0947f62d2b5d6da10a55f7b9073f1b4c4f0b6f68b540', 0, NULL, 34, NULL, NULL, NULL, 'adfds#fddas.com', NULL, NULL, 1)
acts_as_authentic do |a|
a.validates_length_of_password_field_options = { :within => 1..15, :on =>:update, :if => :has_no_credential?}
a.validates_length_of_login_field_options = { :within => 1..15, :on =>:update, :if => :has_no_credential?}
a.account_merge_enabled true
# set Authlogic_RPX account mapping mode
a.account_mapping_mode :internal
a.disable_perishable_token_maintenance = true
a.login_field = 'username'
end
well it this could have been a problem with mass-assignment.
If I do a
u.perishable_token = Authlogic::Random.friendly_token
u.save
then it works just fine.